Ok, so, many of you have seen things like index.php?id=1 or index.php?id=1&type=blah on websites. Here is how we designers do it.
For something with one variable, like index.php?id=1, use the following code. Place this code as your entire index.php (NOTE - It HAS to be index.php, .html will do you no good).
Please note you must make 001.php and 002.php and index2.php for that to not give you any errors.Code:<?php $page_id = $_GET['id']; switch($page_id) { *case '1': //page 1 * *require_once('001.php'); * *break; *case '2': //page 2 * *require_once('002.php'); * *break; *default: //if no cases matched * require_once('index2.php'); * *break; } ?>
For multiple variables (I am only using two, but you can add more) like index.php?id=1&type=blah, use this code in your index.php.
You can put as many elseifs in there as you like. I hope this helps some of you.Code:<?php $page_id = $_GET['id']; $type_id = $_GET['type']; if(empty($_GET['id'])&&empty($_GET['type'])){ require_once('index2.php'); //index page }elseif(empty($_GET['id'])&&$type_id=='blah'){ require_once('index2.php'); }elseif ($page_id=='1' && $type_id=='blah'){ require_once('index_blah.php'); }elseif ($page_id=='1' && $type_id=='noblah'){ require_once('index_noblah.php'); }else { require_once('index2.php'); //if no cases matched } ?>