Hey, i need a little help with reg exps.
My site has the page that you are currently viewing stored as a variable called 'page' and i want to use this to highlight on the navigation system which page (or subpage) you are currently viewing.
As an example, say i have a page called 'about' and if i wanted to highlight the part of the nav bar which the link to about resides on i would do something like this:
PHP Code:echo ('part of nav bar');
if ($page == 'about') {
echo ('highlighted nav bar');
** else {
echo ('normal nav bar');
**;
echo ('rest of nav bar');
Now thats simple enough but say i prefix all sub pages of about with 'about_' so if i had an about the site page it would be 'about_thesite', now i still want the 'about' part of the nav bar to be highlighted, this could be achieved by doing this:
PHP Code:echo ('part of nav bar');
if (($page == 'about') || ($page == 'about_thesite')) {
echo ('highlighted nav bar');
** else {
echo ('normal nav bar');
**;
echo ('rest of nav bar');
But that would mean adding each page separately and would be a bit of a pain, what id like is a reg exp so that i could use code which looks something like:
PHP Code:echo ('part of nav bar');
if (($page == 'about') || ($page == 'about_[regexp]')) {
echo ('highlighted nav bar');
** else {
echo ('normal nav bar');
**;
echo ('rest of nav bar');
And the reg exp will let anything that follows 'about_' also highlight the 'about' section of the nav bar (like a wildcard).
Hope that someone can help me with this cause i dont understand reg exps. Ofcourse if there is an easier way to do that id be happy to hear it.
Thanks.
