I have a particular website that I have built using a single main page with content include files that are inserted into the main page with include(). I have used a rather long switch command to decide which content file should be inserted. Basically as follows:
$page = $_GET['go'];
switch ($page) {
case "1": include("content/home.inc");
break;
case "2" include("content/about.inc");
break;
etc.... }
I currently have about 25 case statements, which seems very cluttered. It is also a pain to update the switch statements every time I add a page.
Is there an easier/less complicated way to do this?
Thanks!
2007-08-28
14:36:39
·
3 answers
·
asked by
Tim K
1
in
Computers & Internet
➔ Programming & Design