CODE
<?PHP
// This determines that the string will be called "id"v $id = $_GET['id'];
if(!$id){
include"index.php";
}
elseif($id=="filename"){
include"includes/filename.php";
}
// and if there is an incorrect string, we can direct to a 404 page
else {
include"404.php";
}
?>
// This determines that the string will be called "id"v $id = $_GET['id'];
if(!$id){
include"index.php";
}
elseif($id=="filename"){
include"includes/filename.php";
}
// and if there is an incorrect string, we can direct to a 404 page
else {
include"404.php";
}
?>
-----------------------------------------------
Now it is time to separate it so you people can understand it a little bit more.
-----------------------------------------------
This part of the coding tell the browser to use index.php as the first page that comes up. Most people will need to change this to the name of the file they want to appear on the index page. For example I would put the news into it so my code would me:
CODE
if(!$id){
include"index.php";
}
include"index.php";
}
My Example!
CODE
if(!$id){
include"news.php";
}
include"news.php";
}
Now thats out of the way, time to move onto:
Now this gives the cool URL. Where it says elseif($id=="filename"){, this is what will be on the end of the URL for example; index.php?id=filename. Just change the name from filename to what you want.
Now this bit is what it will include into the page; include"includes/filename.php";. Just change the path to the correct path to the file you want to include. Here is my example:
CODE
} elseif($id=="filename"){
include"includes/filename.php";
}
include"includes/filename.php";
}
My Example!
CODE
} elseif($id=="photoshop"){
include"includes/photoshop_page.php";
}
include"includes/photoshop_page.php";
}
Now this bit adds a 404 Error page, if the page you have put doesn't exsist:
CODE
else {
include"404.php";
}
include"404.php";
}
This will just include a 404 page if the page the browser is looking for doesn't exsist.
------------------------------------------
Adding to your page
Now I will explain how to add the includes to your page. Open up your index page or whatever your main page is, now go to the part where you want all the includes to show. Now put this code:
CODE
<?PHP include ("path/to/your/includes.php"); ?>
And finally, how to add them to your links. This part is simple:
CODE
<a href="index.php?id=filename">Link<a">
discuss this topic to forum
