Posted By

brent-man on 12/01/07


Tagged

php page index


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

willcodeforfood


Dynamic Index


 / Published in: PHP
 

  1. // home.php?act=index
  2.  
  3. <?php
  4.  
  5. if (isset($_GET['act'])) $PAGEACTION = $_GET['act'];
  6.  
  7. else $PAGEACTION = 'index';
  8.  
  9. switch ($PAGEACTION) {
  10.  
  11. // index page
  12. case 'index':
  13. include ('index.php');
  14. break;
  15.  
  16. // an about page
  17. case 'about':
  18. include ('about.php');
  19. break;
  20.  
  21. // $PAGEACTION doesn't exist
  22. default:
  23. // or just forward to home.php?act=index
  24. echo "page does not exist";
  25. break;
  26. }
  27.  
  28. ?>

Report this snippet  

You need to login to post a comment.