I searched Google, it didn't find what I needed.
Back when I was into programming a lot, (high school cause thats when I had programming class) I use to use this code that was the body of the 'index.php' file so that it called on files. This would make it easy because I wouldn't have to make the main layout on every other file.
I believe I had to make the links something like 'index.php?page=WHATEVER' That would call the file whatever.html and it will show were the PHP code was written on the 'index.php'
I have totally forgotten the code and Google didn't help me. Anyone know what I am talking about and think they can help me by supplying the code?
switch ($_GET["page"])
ReplyDelete{
case 'whatever':
$content = "page 1";
break;
case 'whatever':
$content = "page 2";
break;
default:
break;
}
function getPage()
ReplyDelete{
if(isset($_GET['p']))
{
$pageName = $_GET['p'];
switch($pageName)
{
case "main":
$page = "main.html";
$title = "Home";
break;
case "about":
$page = "about.html";
$title = "About";
break;
default:
$page = "main.html";
$title = "Home";
break;
}
}
else
{
$page = "main.html";
$title = "Home";
}
$Info['page'] = $page;
$Info['title'] = $title;
return($Info);
}
$pageInfo = getPage();
$title = $pageInfo['title'];
$page = $pageInfo['page'];
//loads the include
function loadInclude($page)
{
$pagePath = ("inc/" . $page);
include($pagePath);
}
loadInclude($page);
?>