List Navigation Help

liunx

Guest
Hello,

I have created a navigation menu using CSS and the lists technique but i was wondering if there was a valid method for have the link that the page is on to be highlighted or have a different background picture.


I.E my navigation menu;
Home, Products, Brochure, Contact and i am on the Products page.

The product link in the navigationbar woulud be highlighted to show the location of the page.

I would be eternally grateful. Many regards,

David<ul>
<li><span>Current Page</span></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"page1.html">Page 1</a></li>
...
</ul>

style span differently as desiredthanks very much vladdy for your reply.

unfortuantley i am using PHP include() and i wont be able to change the span style for each page as the navigation stays the same.

but i think you get my jist.

many regards,

DavidShooting from the hip here - just a concept probably with a few bugs:
page1.php:
<?php
include('nav.php');
make_menu($_SERVER['PHP_SELF']);
?>


nav.php:
<?php

$menuData = '
<ul>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"page1.php">Page 1</a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"page2.php">Page 2</a></li>
</ul>
';

function makeMenu($currentPage)
{ echo preg_replace('/<a\s+href=http://www.webdeveloper.com/forum/archive/index.php/\"'.$currentPage.'\"\s*>(\w+)<\/a>/',"<span>\$1</span>",$menuData);

}
?>thank you very much vladdy.

I will certainly try that. Just after i posted this, I thought of this posibility. How about this:

You have the

<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"link.php"><span id="home">LINK</span></a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"link.php"><span id="about">LINK</span></a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"link.php"><span id="brochure">LINK</span></a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"link.php"><span id="contact">LINK</span></a></li>

and just not include these span IDs on the stylesheet. Include the #home { background: urL(); } on the page.

I am not sure if this would work.g
 
Back
Top