Best PHP nav ever


PHP Code
  1. <?php
  2. $id = $_GET['id']; //get the value of $id
  3.  
  4. if (empty($id)) //if no id was requested, then include our default page - like a welcome message for example. DON't make it index or it will loop for ever as it will include index, again and again and again.
  5. {
  6. include("news/display.php"); //include this page
  7. }
  8. else
  9. {
  10. if (file_exists($id.".php")) //else we check the requested page exists..if it does, include it
  11. {
  12. include($id.".php");
  13. }
  14. else //else the page doesn't exist, so show our error page or whatever.
  15. {
  16. echo("Page Not Found. Please Try Again.");
  17. }
  18. }
  19. ?>
ray230's Avatar
Author:
Views:
2,655
Rating:
Posted on Wednesday 3rd October 2007 at 03:21 PM
darklight19
darklight19's Avatar
Lol, I was doing this before I seen this xD