Thread: Help w/ PHP
View Single Post
  #5   Spotlight this post!  
Unread 25-10-2006, 20:48
RoboJedi75's Avatar
RoboJedi75 RoboJedi75 is offline
Do or do not, there is no try.
AKA: Nate Fong
FRC #0075 (RoboRaiders)
Team Role: Alumni
 
Join Date: Feb 2006
Rookie Year: 2004
Location: Hillsborough, New Jersey
Posts: 79
RoboJedi75 has a spectacular aura aboutRoboJedi75 has a spectacular aura aboutRoboJedi75 has a spectacular aura about
Send a message via AIM to RoboJedi75 Send a message via Yahoo to RoboJedi75
Re: Help w/ PHP

Another option if you have a lot of pages: you can create the basic layout page (the header and the footer) and replace the body content with this code:

PHP Code:
if($_GET['page'] == "") {
    include(
"includes/main.php");
} else if (!
file_exists("includes/".$_GET['page'].".php")) {
    echo 
"Page not found.";
} else {
    include(
"includes/".$_GET['page'].".php");

This code just checks that a body content file exists and then loads it. Navigation is done by index.php?page=home. If no extenstion is given, then it loads main.php.

It's simple and I've seen a lot of websites use this method.
__________________
Nate Fong
Team #75, the RoboRaiders, Alumni