Home arrow PHP arrow Page 5 - Building a Site Engine with PHP, Part 2

Bring it Together - PHP

If you read the first article in this series, you’d know that we’re about to start talking about the plug-in and module system for our site engine. Along with the plug-ins and modules, we’re also going to be discussing some of the general functions that are needed to make site engine work correctly.

  1. Building a Site Engine with PHP, Part 2
  2. Best Site() Ever Made
  3. OK, Plug it in Now
  4. Module Madness
  5. Bring it Together
By: James Murray
Rating: starstarstarstarstar / 70
June 14, 2004

print this article



We have everything here ready to go. Now we just need to put it all together so that it will run. I made a file that basically includes all the files we've just put together. That way we only have to include one file on our index page so it doesn't become all cluttered up. Save this as "your_site_dir/inc/core.inc.php".


$config = new config();

$sql = new sql($config->dbhost,$config->dbuser,$config->dbpass);

$site = new site();

$plugins = new plugins("1");

$modules = new modules("1");


Pretty simple and self explanatory. All we did was include all the files in the /inc directory, then we initialized the classes that are defined within them.

Now all we have left is the index page -- another simple bit of work. All we really have in the index page is a quite common parse time function and an include. Save this file as "your_site_dir/index.php".

function getmicrotime()
{    $temparray=split(" ",microtime());
    return $returntime;



Final thoughts

That's all we have to do for the plug-in and module systems. In the next article in the series, we'll go through the authentication system and the block system. I'll also show you how the database and directories should be set up so you can set up your first plug-in and module and give it all a try. Following that will be an article illustrating how to build the template and loading system of the site engine. Then finally, there will be an article on making an administration page and how to quickly build a site with the site engine.

>>> More PHP Articles          >>> More By James Murray

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: