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

Build your very own Theme Park! - PHP

So you want to use your site engine that you’ve been working on? Okay, now is the time for me to show you how to add plug-ins, modules, blocks, and templates to your database so that they will work with your engine. It’s not that hard to do, and with just a few simple steps, you’ll be running your site off your new stylish site engine in no time.

  1. Building a Site Engine with PHP, Part 5
  2. Plug it in, Plug it in!
  3. All your Modules Belong to MySQL
  4. Improve your Blocking Skills
  5. Build your very own Theme Park!
By: James Murray
Rating: starstarstarstarstar / 32
July 19, 2004

print this article



Templates are very easy to set up and install. Basically you only have one table to mess with when installing a template, however you actually have to put information into two tables. You just said “huh!?” Well to begin you have the table that holds all the information about the templates, but then you also have the template_users table which contains all the information about what users are using which template. So you kind of have to set up both.

The templates table is where you’re going to put in information about the template name, the template author, the template’s install date, the template file and the template status. Just like all other components, the template author and the template date are optional. The first field is t_name; this contains the name of the template file. I did it this way so you could have more than one template in the same folder in case you have templates that are slight variations of other templates. Then there is the t_file field, which is more like the plugin_file. Put in the name of the folder that contains the actual template. After that you have the t_status which is where you’d set the default template but put in the word “loaded”. Otherwise you can leave it blank or put in a value other than “loaded”. And by now you should already know what to do with the t_name and the t_date fields. I leave them blank, but I like to know they are there in case I want to use them.

In the template_users table all you have is a field named user_ID that holds the user_ID that corresponds to the user_ID in the users table. After that is the t_ID, which is the ID that is given to a template when you install it into the database, by the auto increment field in the templates table. I have it automatically fill in this information when a user registers so that way you don’t have to do anything with the table at all. That’s all up to you, but personally I wouldn’t like making a full time job out of manually updating the database.

It’s all Over

This is the last part of the last article in this series. If you’ve read all 5 articles, you should now have a good understanding on how to build a site engine. These articles weren’t made to give you a site engine; rather I wrote them to touch on the more confusing parts of building something like what I have. I hope that my articles have helped you to learn some cool new things about how you can work with PHP to make a seemingly self-aware site. And I hope that it’s furthered you in your knowledge of PHP. I’d be happy to lend more information and pointers in the future to those that need a bit of help. I’d also love to see what you can produce while keeping this series of articles in mind. But for now I’ve about said all I think I can say about the theories, ideas, and structure behind a true site engine. Thanks for reading my articles.

>>> 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: