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

First Things First - PHP

Content management systems are becoming very popular, but what if you took it a step further than that? That’s exactly what I plan to show you how to do in this series of articles. I’m going to explain how to build a site engine. A site engine is a core code base and database that can run multiple sites that are completely different while all running in unison, using all the same code, yet separate from each other.

TABLE OF CONTENTS:
  1. Building a Site Engine with PHP, Part 1
  2. First Things First
  3. Better Than your Local Rental Security Officer
  4. The Template Got All GUI
  5. Build It and They Will Come
By: James Murray
Rating: starstarstarstarstar / 136
June 07, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

The best thing to do first, I say, is to get out some paper and one of those sticks that write stuff.... Oh, yeah, a pencil! Then literally draw out a diagram of your plan on coding. No need for a bunch of words, just horribly sketched boxes and lines, labeled with each elements name. I decided that I would need to first create, in order, the following things for my site engine:

  • Database
  • Main index page
  • Plug-in system
  • Module system (plug-ins for the plug-ins)
  • Content blocks

So, trying to stay advanced, I grabbed my $5 mechanical pencil, and I sketched it out like this:

Pretty isn't it? Basically, what I have here is my index page calls the database, selects all the plug-ins that are initialized for the specific site, then the plug-ins select all the modules that at initialized for the selected plug-ins. Then the modules select all the content blocks that are initialized for the selected modules with a few more parameters checked, such as authentication level and specific page. Then it's all returned to the index page to form the website. This diagram is an easier read.

Index >--call plug-ins--> Loaded Plug-ins >--call modules--> Loaded modules >--call block--> Loaded blocks >--return data--> Index displays data

This has shown to be a very solid method of doing a plug-in system, due to the fact that if a plug-in isn't loaded the content block that depends on that certain plug-in won't load and cause nasty errors. Now that the plug-ins have been briefly described, I'll talk about the authentication and block systems.



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

blog comments powered by Disqus
   

PHP ARTICLES

- 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...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 2 - Follow our Sitemap

Dev Shed Tutorial Topics: