PHP Tutorials [Navigation 02 Tutorial]

This is another method of doing this, which I think is pretty cool. But I'm to too lazy to elaborate on it too much, so I suggest you read the first tutorial.

<?php
if (! file_exists("$page.php"))
{
include("404.php");
}
else
{
include("$page.php");
}
?>

Now that goes in your main page where you want the content to show up. Lets say you pasted it into index2.php. You need to make a 404.php and upload it in the same directory. Now you make the links to:

index2.php?page=whatever

Now as long as the file "whatever.php" exists in that directory, it will show up. If whatever.php does not exist, 404.php will display. You can download the example.

If you find this information inaccurate or have questions post in the forums