You're right, and your explanation makes since...thank you! I was able to track down the parse error in the code posted in #4, and the error was throwing due to a missing } prior to the first else. It stated line 27...so I looked above and below that line and caught the error.
PHP Code:
// did user request a page?
if( isset( $_GET["page"] ) ){
// yes: does the requested page exist?
if( isset( $pages[ $_GET["page"] ] ) ){
// yes: show it
$page = $_GET["page"];
//added }
}else{
// no: show a 404 page
$page = 404;
}
}else{
// no: show the home page
$page = "home";
}
If it helps anyone else, here is the finalized code.
PHP Code:
<?php
$pages = array(
"home" => array(
"title" => "Home",
"display" => "page_content/home.php",
"description" => "This is the home page!",
),
"administration" => array(
"title" => "Administration",
"display" => "page_content/administration.php",
"description" => "This is the administration page!",
),
"404" => array( /* etc. ... */ ),
// etc. ...
404 => array(
"title" => "Page Not Found",
"display" => "page_content/404.php",
"description" => "The page you requested was not found!",
)
);
// did user request a page?
if( isset( $_GET["page"] ) ){
// yes: does the requested page exist?
if( isset( $pages[ $_GET["page"] ] ) ){
// yes: show it
$page = $_GET["page"];
}else{
// no: show a 404 page
$page = 404;
}
}else{
// no: show the home page
$page = "home";
}
$title = $pages[$page]["title"];
$display = $pages[$page]["display"];
$description = $pages[$page]["description"];
?>
Bookmarks