PHP
  Home arrow PHP arrow Page 5 - Building a Site Engine with PHP, Part 2
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Building a Site Engine with PHP, Part 2
By: James Murray
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 70
    2004-06-14


    Table of Contents:
  • Building a Site Engine with PHP, Part 2
  • Best Site() Ever Made
  • OK, Plug it in Now
  • Module Madness
  • Bring it Together

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Building a Site Engine with PHP, Part 2 - Bring it Together
    ( Page 5 of 5 )

    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".

    <?PHP

    @include('inc/config.inc.php');
    $config = new config();

    @include('inc/sql.inc.php');
    $sql = new sql($config->dbhost,$config->dbuser,$config->dbpass);
    $sql->_select_db($config->dbname);

    @include('inc/site.inc.php');
    $site = new site();

    @include('inc/plugins.inc.php');
    $plugins = new plugins("1");

    @include('inc/modules.inc.php');
    $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".

    <?PHP
    function getmicrotime()
    {    $temparray=split(" ",microtime());
        $returntime=$temparray[0]+$temparray[1];
        return $returntime;
    }
    $stime=getmicrotime();

    @include('inc/core.inc.php');

    $etime=getmicrotime();
    $ftime=round($etime-$stime,6);
    ?>

    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
     

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek