
No.. you don't edit anything..
In the code Dentafrice posted, you don't edit a thing, you simply put it into your layout where you want your content, and use the url:
http://www.yourwebsite.com/index.php?page=(page)
It's better than having to edit the php script that you have everytime you have a new page.
My last reputation was from ThisNameWillDo!.
Oh OK, thanks. It just confused me not having to tell it what the files were etc.
You get that from the variable.
The only thing now is, when I go to http://localhost/site/ it shows the 404 error in the content area instead of my homepage content. It only shows the homepage once I click 'Home' on the nav.
Is there a default setting I can add to that code or something?
Code:<?php $page = $_GET["p"]; $page = "{$page}.php"; if(!file_exists($page)) { include "404.php"; } else { include $page; } ?>
PHP Code:<?php
$page = $_GET["p"];
$page = ($page == '') ? 'home' : $page;
$page = "{$page}.php";
if(!file_exists($page)) {
include "404.php";
} else {
include $page;
}
?>
thank you sir.
Edit the part that says home for the page you want.
home is exactly what I wantI'll owe you about 3 reps lol
Want to hide these adverts? Register an account for free!