Thanks for that Malcolm.
However, first I should clarify that I am not using a database to generate the site.
I have a static website with some dynamic functions - using PHP to do the dynamic bits.
I specify at the beginning of each page what it is, relative to the information architecture using:
The reason I do this is to control the secondary-navigation.
My secondary-navigation is a long unorderd list (<ul>) with many sub-lists, e.g:
Code: Select all
<ul>
<li><a href="e;#"e;>Services</a>
<ul>
<li><a href="e;#"e;>Administration</a>
<ul>
<li><a href="e;#"e;>Weekly Administration</a></li>
<li><a href="e;#"e;>Monthly Administration</a></li>
</ul>
</li>
<li><a href="e;#"e;>Cleaning</a></li>
</ul>
</li>
<li><a href="e;#"e;>News</a></li>
<li><a href="e;#"e;>About Us</a>
<ul>
<li><a href="e;#"e;>Why Us </a></li>
<li><a href="e;#"e;>History</a></li>
</ul>
</li>
<li><a href="e;#"e;>Contact Us</a></li>
</ul>
Each of these has PHP in them to decide what page a user is on (from the $thisPage definition at the beginning of the page).
Based upon that, the secondary-navigation only displays the relevant sections, and sub-section as necessary (based upon the $thisPage variable and clever use of more PHP and CSS).
For example, if I was on a Service page, the secondary-navigation would look like:
Code: Select all
<ul>
<li><a href="e;#"e;>Services</a>
<ul>
<li><a href="e;#"e;>Administration</a>
<ul>
<li><a href="e;#"e;>Weekly Administration</a></li>
<li><a href="e;#"e;>Monthly Administration</a></li>
</ul>
</li>
<li><a href="e;#"e;>Cleaning</a></li>
</ul>
</li>
<li><a href="e;#"e;>News</a></li>
<li><a href="e;#"e;>About Us</a></li>
<li><a href="e;#"e;>Contact Us</a></li>
</ul>
And if I was in the About Us section, I would get:
Code: Select all
<ul>
<li><a href="e;#"e;>Services</a></li>
<li><a href="e;#"e;>News</a></li>
<li><a href="e;#"e;>About Us</a>
<ul>
<li><a href="e;#"e;>Why Us </a></li>
<li><a href="e;#"e;>History</a></li>
</ul>
</li>
<li><a href="e;#"e;>Contact Us</a></li>
</ul>
This allows me to use a master menu file as a PHP include, reducing maintenance and making it easy to grow the site when I need to.
That is why I started with:
Code: Select all
<?php if ($thisPage=="Services") echo "Services"; ?>
<?php if ($thisPage=="News") echo "News"; ?>
<?php if ($thisPage=="About Us") echo "About Us"; ?>
<?php if ($thisPage=="Contact") echo "Contact"; ?>
But that only works if there is an exact match (and it is quiet messy too).
I need the code to say:
if ($thisPage[is equal to, or begins with]"Services") echo "Services"; ?>
The [bit in here] in the code is the PHP or regular expression that I need.
The H1 tags are in the webpage, and this script is being called as an include, between the H1 tags.
As for your kind response, I do not know how to get that to work in my situation. I can only apologise for my lack of understanding (and can promise to try harder to learn!).
Thanks once again.