I have a website with the pages shown in the if statement below on the root level and other web pages inside a folder.
http://www.mysite/folder_a
I use a functions.php page so that the head and foot tags and style sheet are all the same and I call it with this on the root level pages:
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
$title = "$page_title";
include('functions.php');
do_html_header($title);
?>
and change
include('functions.php');
to this
include('../functions.php');
on the pages in folder_a.
I'm trying to set the navigation up so that I don't have to use 2 seperate functions.php pages, one for the root level pages and another for the folder_a pages.
$valid_pages = array( "Welcome", "Contact Me", "Product Page");
if (in_array($title , $valid_pages) ) {
echo "
<ul>\n
<li><a href='../index.php'>Home</a></li>
<li><a href='../products.php'>Products</a></li>
<li><a href='../contact.php'>Contact</a></li>
</ul>
";
} else {
echo "
<ul>
<li><a href='index.php'>Home</a></li>
<li><a href='products.php'>Products</a></li>
<li><a href='contact.php'>Contact</a></li>
</ul>
";
}
This is turning out to be quite a challenge and although I don't like hard coding navigation links with
http://www...
, I may have to.