Code: Select all
<?php
require_once 'includes/user_standard.php';
// Ensure that a page was requested
if(!isset($_GET['page']))
{
// Assume "default" page
$pageName = $default_page;
}
else
{
// Save name for easy use
$pageName = $_GET['page'];
}
// Get page
$page = getPage($connection, $pageName);
if($page === false)
{
// Try to get error page
//$page = getPage($connection, $error_page)
if($page === false)
{
die("An error occured while retrieving page '{$pageName}.'");
}
}
// Get template
$template = getTemplate($connection, $page['template_name']);
if($template === false)
{
die("An error occured while retrieving the template " . $page['template_name'] . " for page '{$pageName}.'");
}
// Parse and output
echo parseTemplate($connection, $template, $page);
?>Thanks in advance for any ideas.
--EDIT--
Here's what a normal page would look like:
Code: Select all
<!-- Include of template header -->
<html>
<head>
<title><!-- Begin substitution title -->Main page<!-- End substitution --></title>
</head>
<body style='margin: 0px; padding 0px;'>
<div style='width=100%; height: 50px; left: 0px; top: 0px; background-color: #FF0000; color: #00FF00;'>
<!-- Begin substitution title -->Main page<!-- End substitution -->
</div>
<div style='width=100%; top: 50px; left: 0px; background-color: #0000FF; color: #FF00FF;'>
<!-- End include -->
<h1><!-- Begin substitution title -->Main page<!-- End substitution --></h1>
<p><!-- Begin substitution content -->This is the main page of this site. It's obviously extremely pre-alpha. :)<!-- End substitution --></p>
<!-- Include of template footer -->
</div>
</body>
</html>
<!-- End include -->And here's what a non-existent page error returns (with the attempt to retrieve the error page commented out, as above)
Code: Select all
An error occured while retrieving page 'asdf.'