Insert this code into your content area:
Code:
<?
$val = $_GET['id']; // Replace id with whatever you want to use, eg ?id=page
$val .= ".php"; // Makes the filename complete so if you called ?id=index, it would be index.php it has to look for
$dirty = array("..");
$clean = array("");
$val = str_replace($dirty, $clean, $val); // Prevent people from viewing root files like your password
if (isset($_GET['id'])) { // Replace id with whatever you want to use, eg ?id=page
if (file_exists($val)) { // This checks if the file you are trying to call exists
include "$val";
}
else {
include "404.php"; // If the file doesnt exists it calls your 404 error page
}
}
else {
include "home.php"; // If ?id= is not set it will now go to your news page
}
?>
I didn't make this script nor do I claim to. All your pages will have to be renamed to have .php extensions. This script is amazing, very easy to update pages.
Also use php includes for static content:
Code:
<? include("yourfilename.php") ?>