Log in

View Full Version : Arrow Green Vertical Menu - SSI question



Geezer D
10-16-2008, 06:09 PM
Hi, all.

Is it possible to use the "selected" feature with this code if I have the nav bar code in an SSI file?

What I mean is, when you're on a page, the navbar displays the current page as "selected", therefore a different image on that <li> on the navbar.

I'm doubting it, since the class="selected" code has to be put into each individual page, and that's not possible, since it's just accessing the navbar with SSI.

But if it IS possible, let me know, thanks!

olveyphotodesign
10-16-2008, 08:01 PM
What you would need to do is add some server side scripting to the SSI that would determine the page requesting the include. Once you have done that, then you would tell it to echo the selected class attribute on the appropriate <a> tag.

For Example

$page = basename($_SERVER['SCRIPT_NAME']) // determines name of page requesting include.


<li><a href="http://www.happy.com/about.php" <?php if ($page === "about.php") { echo "class=\"selected\"";}?> title="About Me">About Me</a></li>

Don't confused the address in the <a> tag with the requesting script the SSI is being sliced into.

The if conditional statement is only executed if the page is about.php. You would need to add this if statement to each of the <a> tags in the SSI. I'm sure there's another way, however I know this should work.

Geezer D
10-16-2008, 11:39 PM
Well, yuh lost me, lol. I don't know PHP at all.

Geezer D
10-17-2008, 11:17 PM
nevermind.... ;)