Misc Links
Forum Archive
News Archive
File DB
 

Ads
 

Advertisement
Unlock your Iphone
Unlocking and Jailbreaking your iPhone isn't easy. We recommend Unlock iPhone 3G Software!
 

Latest Forum Topics
I Just Rickrolled A Telemarketer
Posted by Red Squirrel
on Sep 08 2010, 7:10:41 pm

New Bathroom Fan I Bought
Posted by Red Squirrel
on Sep 06 2010, 9:08:47 pm

Duke Nukem Forever
Posted by Red Squirrel
on Sep 04 2010, 1:28:13 am

Dr. Santa Claus?
Posted by Red Squirrel
on Sep 04 2010, 5:12:17 pm

Vmware Shifts Pricing Strategy
Posted by Red Squirrel
on Sep 02 2010, 7:09:04 pm

 



Send spam to: website@xeonlive.com nick@xeonlive.com georgiapeach1241@aol.com
Creating your own content management system with php
Better control of site content and access
By Red Squirrel


The following steps will be involved when a page is requested from the CMS system:

1) The client requests a certain page, and sends the cookie information stored for the CMS.

2) The CMS main page (index.php) loads the validation module, which can be a separate file.

3) The validation module checks to see if the cookie information sent matches with a user in the database, if there is no cookie, the guest profile is used.

4) We make sure the module requested actually exists, if yes we include the file, if not we change the requested module to be the 404 one so when the module loads, it will load a 404 page.

5) If the user has access to this document, we keep going, otherwise we switch to showing the login module instead.

6) The header template is loaded. This is the start of the actual html output.

7) Depending on the document requested (via a query string, such as index.php?document=home) the right file is included, if it's an invalid request we'll load the 404 module.

8) Depending on what the document is suppose to do (ex: load various info from a database) it does it.

9) We then load the footer template, then exit.

Of course, this can change depending on how you program it.

So a basic structure for this would be to have an index.php that handles all the requests, a auth.php which handles the authentication stuff, a header.php which is mostly html for the header, a module/[name].php for each different page and finally, a footer.php which would be mostly html for the footer.

The index.php's job would also be to determine what page to load, let's say we have the url index.php?page=articles it would then load the module/articles.php page.

So here's some code for index.php



1: here we simply put the var of the get (index.php?page=) into another var. This is in case we decide to change page= to something else, like module=, it makes it so you have less variables to change. On the line after we just default to home if the var is empty.

2: Here we check to make sure it is valid, I'm sure there's better and more dynamic ways to do this, but to keep things simple, this is how I did it here.

3: Here we include a script that will take care of authenticating the user, we chose to put this after the requested page stuff for a reason, because we'll want the $module variable later in this file.

4: This is where we include a file, probably mostly html that starts to build the layout - the header.

5: Here the right module is loaded. If there are other arguments such as act= they are handled in that file. Html data would also be in this file, to form the actual content, but thanks to css, the colors could still be handled in the header, so change the css values, and you can change all the pages' colors.

6: Finally, we end with the footer, closing off the html output.

On the next page we'll take a look at how auth.php will handle logins and such.


Next Page
spacer
18984 Hits Pages: [1] [2] [3] [4] 1 Comments
spacer


Latest comments (newest first)
Posted by Andy on October 10th 2004 (07:52)
LOL I was about to say. WOW this guest is smart. Why can't i find someone like that at my site. laugh.gif
spacer
View all comments
Post comment

RPGBids Your MMO MMORPG Auction Super Site

Top Articles Latest Articles
- What are .bin files for? (593220 reads)
- Big Brother and Ndisuio.sys (143171 reads)
- PSP User's Guide (127825 reads)
- Text searching in linux with grep (115463 reads)
- SPFDisk (Special Fdisk) Partition Manager (101368 reads)
- Dynamic Forum Signatures (version 2) (4716 reads)
- Successfully Hacking your iPhone or iTouch (14371 reads)
- Ultima Online Newbie Guide (25137 reads)
- BBcode editor: PHP - The sensible approach (17950 reads)
- The Hitch Hikers guide to "the mouse" (15326 reads)
corner image

This site best viewed in a W3C standard browser at 800*600 or higher
Site design by Red Squirrel | Contact
© Copyright 2010 Ryan Auclair/IceTeks, All rights reserved