Thread: Help w/ PHP
View Single Post
  #6   Spotlight this post!  
Unread 25-10-2006, 22:19
GRaduns340 GRaduns340 is offline
The Fruit Man
AKA: Gary
FRC #0340 (Greater Rochester Robotics)
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Rochester, NY
Posts: 152
GRaduns340 has a spectacular aura aboutGRaduns340 has a spectacular aura aboutGRaduns340 has a spectacular aura about
Send a message via AIM to GRaduns340
Re: Help w/ PHP

Quote:
Originally Posted by RoboJedi75
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.
That's probably a better idea than I suggested. I guess I just overthought it. I've used that method, too, and it is certainly simple enough to pull off.