PHP
  Home arrow PHP arrow Page 5 - Building a Site Engine with PHP, Part ...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
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? 
PHP

Building a Site Engine with PHP, Part 5
By: James Murray
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 32
    2004-07-19

    Table of Contents:
  • Building a Site Engine with PHP, Part 5
  • Plug it in, Plug it in!
  • All your Modules Belong to MySQL
  • Improve your Blocking Skills
  • Build your very own Theme Park!

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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 5 - Build your very own Theme Park!


    (Page 5 of 5 )

    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.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · great articles... thanks :)
       · Thank you for the articles! My question is: why it is necessary to have a...
       · it would still be very helpful to me if a complete directory structure of a working...
       · If anyone has gotten this to somewhat work. (ie knows which files should go where)...
       · i'm taking a very good look at it and i almost have it up and running...i'll keep...
       · I was thinking of designing something very similar but I'm working backward. I...
       · I read just the first article. I didn't read the rest 4 just because:1) they were...
       · Just copy and paste the code from here into your favorite editor (Crimson Editor),...
       · I wouldn't call comments 'breaking up the code', quite the opposite, they make it...
       · Yeah really, its not that hard to do. ;)
       · I too have gotten most of it to work. The only thing I am still struggling with is...
       · ok for the people who like to have a zip package with a working version how i see...
       · damn... link formatting wont work >(well here goes for the sql...
       · scroll down :)
       · Thats great! Thanks.I see you have not used any of the modules though im still...
       · Link formatting works if you are logged in. You can create a free blog account. It...
       · yes i was looking for that too... where can a do that?
       · i didnt have the time to look at the module system.i'm not sure how they suppose...
       · You can create your fee blog account...
       · i've got it al working now, but i have one question.How can I make a difference...
       · I think this article is for beginners php.........but its good overall
       · when you make an instance of the site class, it looks if the page var is set.You...
       · but, this is my blcok_location table:bl_ID block_ID block_row block_col ...
       · in the [color=red]SITE_ROOT\plugins\blocks\main.plug.php[/color] find the...
       · That's great!I really couldn't understand that piece of code and i knew Jaimz...
       · I get a few notices (Notice: Array to string conversion in...
       · The exact same thing happens for me. Regardless of what I set the page variable as,...
       · you need to change you php.ini so that it does not report notices (search for error...
       · struggling with this PHP thing, tried your package and got the following...
       · HelloI am not php programmer, but I have been motivated by these great...
       · output your SQL string to the screen and look for wrong SQL parts. Probably there is...
       · for the php4 conversion, look at the discussion of the previous parts of this...
       · i'm happy i just made this system work and it looks good ... but i have a few...
       · everythign is controlled via the database, depending on what PAGE and what SITE...
       · ok... and how about the first question.?
       · let's say i have a link on my main page - "News". how do i do the...
       · Nice article!
       · Same problem for me too.. I've looked at it for 1 hour or so, it seems correct......
       · i'm having the same problem? did anyone find a solution yet?
       · i've found a temporary solution, and i don't know if it's the best one. in...
       · ok... everything is working nice and smooth... but i have a question. does anyone...
       · Thanks for the superb articles! Great work indeed :)Ok, so now I've begun to...
       · Hehe, yeah, that works :) but the moment you want to do a page that only some users...
       · Sorry I meant parentheses not comas :)Btw, great articles! Helped me a lot in my...
       · um, there is no "wrong" way of doing anything Jaimz provided everyone with a...
       · hi,i have problem with CURRENT TEMPLATEif i want different template for each...
       · good
       · Don't get me wrong this is a very useful article which is almost exactly the same...
       · replace your dbhost, dbuser, dbpass and dbname in config.inc.php with your database...
       · replace your dbhost, dbuser, dbpass and dbname in config.inc.php with your database...
       · libxml2-2.6.13-1.i386.rpmlibxml2-devel-2.6.13-1.i386.rpminstall both of em adn...
       · I really liked the article series, it is a good starting point for building a site...
       · Hi, your articles are really very good for newbie PHP programmers trying to...
       · I saved the auth, blocks and templates files as includes which is more logical...
       · this type of engine is being used on a high-traffic production server. dont doubt...
       · um your not understanding how this engine works, you define what pages the blocks...
       · Help me please! It is possible to give an example operations on such site of the...
       · Hey Jefrey,This link is not accessible anymore, coul dyou please make the file...
       · Thanks for the articles it has been an interesting read.To my knowledge and I...
       · Hi,are these two files aviable somewhere to download? The original sourc is...
       · Forgive for, probably, silly question. For example, I have a class gallery and...
       · this code doesnt work i allways get a mysql connection error and the php files are...
       · The tutorial is meant as a base to work out from. you need to think out the rest for...
       · I registred member but I cant download the script.Somebody please send me this...
       · Authors who are confident in their subject and what they have written usually post...
       · Does anyone still have a copy of the source in a zip file for this?
       · Sure. Why does someone write an article anyway? Some people simply build code and...
       · If 10 people read this article and attempted to build the source code, you'd have 10...
       · I think, that sources must exists! 'cause the article is not so full to show the...
       · I agree that the point of this article was to teach and not provide a download for...
       · umm.. this article is YEARS old.. and back when i first found it, it didnt take me...
       · I've read through all five articles and really appreciate the effort the OP put in...
       · Hopefully some one still reads these discussions about the site engine :) The idea...
       · When you ask about the 'main.plugin.php' file, I am thinking that you may not be...
       · Hi everyone,I apologize for being too late with this post. I have just found...
       · Yeah,I would also like to encourage James to update and continue this article...
     

       

    PHP ARTICLES

    - Authentication Scripts for a User Management...
    - Utilizing the Use Keyword for Namespaces in ...
    - Building a User Management Application
    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT