Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SSI Navigation

Status
Not open for further replies.

LOW

Programmer
Sep 27, 2000
45
US
I've created secondary navigation within a website using an SSI file. It's a list of links. I would like to add some logic so that when you're on one of the pages in the link list, that particular link becomes inactive or perhaps just without text-decoration. I'm not sure how to go about that. Any ideas?
 
You'll either need server-side scripting (to test for current page) or a different navigation set for each page (using CSS).

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
make a class for each link using CSS
set them all to be the same in your stylesheet

then at the top of each page, change the class for the element that you want to look different.

- Web design and ranting
- Day of Defeat gaming community
"I'm making time
 
Yes, which will require server-side scripting or, worse, JavaScript.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
That's a great idea. Thanks Foamcow.
 
Right Foamcow, but if LOW is going to have one navigation file that he plans on SS including, then somehow that page will have to have intelligence to determine which page it's on right now, and then apply that style to it.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
Additionally, I don't see any style changes in the navigation on your site, regardless of what page I browse.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
SSI is server-side, hence the name Server Side Includes. [wink]

I'm really rusty on SSI so the following will likely need tweaked but this is the logic you need for it.

Code:
<!--#if expr="$SCRIPT_NAME = '/page1.shtml'" -->
Page is page1.shtml
<!--#elif expr="$SCRIPT_NAME = '/page2.shtml'" -->
Page is page2.shtml
    <!--#else -->
Page is none of the above
<!--#endif -->

You just need to use the above to set the appropriate class for your CSS to display.

Hope this helps

Wullie

Fresh Look - Quality Coldfusion Hosting

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
with SSI nav you can give each <a> element an ID then overide just that ID in the page.
Bit of a pain with 1000 pages to do manually, but easy enough for a few.



Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
There, the proper nav file is up there now.


I have 1 navigation file included on every page of the site with an SSI.

it looks like this.
Code:
<ul>
				<li class="navHome"><a href="[URL unfurl="true"]http://www.foamcow.com/index.php"[/URL] title="Foamcow Heavy Industries">home</a></li>
				<li class="navAbout"><a href="about.php" title="Foamcow (a.k.a. Pete Eveleigh) Web designer and digital artworker">about</a></li>
				<li class="navRant"><a href="rant.php" title="Pete Eveleigh rants about this and that... kind of a blog">rant</a></li>
				<li class="navWork"><a href="work.php" title="Portfolio of web design and print artwork">work</a></li>
				<!--<li><a href="knowledge.php" title="F.A.Q.s tips and tricks for CSS, XHTML, Quark Xpress, Photoshop etc.">knowledge</a></li>//-->
				<li class="navLinks"><a href="links.php" title="Links to Foamcow's favourite sites">links</a></li>
				<li class="navContact"><a href="contact.php" title="Contact Foamcow Heavy Industries">contact</a></li>
			</ul>

The CSS file defines all those classes to display grey text.

Then at the top of each page in the site I have something like:
Code:
<style type="text/css">
		#leftCol ul li.navRant a {color:#ff9933;}
</style>

Over riding the style set for that particular item in the nav.

Could be a bit of a pain to maintain on a large site. But it's very easy once set up on a small site.

- Web design and ranting
- Day of Defeat gaming community
"I'm making time
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top