Welcome to WebmasterWorld Guest from 35.172.195.49

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

Using Apache SSI conditional statements

for Navigation Bar

     
3:23 pm on Jan 7, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 25, 2003
posts:664
votes: 0


Hello. I am designing a site using SSI. I have the top navigation bar using SSI. I wanted to do something special with the buttons when the user is on the corresponding page. If the user was on the Home page, I would like the Home button to be a different color, of if the user was on that About page, I would like the About button to be a different color. An example of this is ont he APC website, even though this is a common look on sites. Would I have to design seperate navigation bar SSI files for each specific page, or is there a line of code in php that will allow the one navigation page to know which actual page the user is on and highlight the corresponding button.

Thanks in advance for the help. Hope it made sense. :)

Wes

5:05 pm on Jan 7, 2004 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15756
votes: 0


I have to admit wfernley, my SSI is a little rusty (it's been a few years) but I have done some searching and it seems to be coming back to me a bit.

Look for the piece on "Conditional Expressions"
Apache Tutorial: Introduction to Server Side Includes [httpd.apache.org]

Apache Module mod_include [httpd.apache.org]

On the second page take a look at "Include Variables", specifically DOCUMENT_URI, and "Variable Substitution". There are some examples there for using the DOCUMENT_URI to test for the location of the file. You can test for directories as well but I can't quite remember the proper syntax.

Then you could have a conditional statement in your nav bar that figures out what page it is being included by and shows the appropriate images. Remember that DOCUMENT_URI will give the path of the page doing the including not the page being included.

5:44 pm on Jan 7, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 25, 2003
posts:664
votes: 0


Excellent thanks for the reply. I will start looking that over now.

Thanks again. :)

Wes

6:12 pm on Jan 7, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 25, 2003
posts:664
votes: 0


Actually one thing I should mention is that I am using PHP as my scripting language. Does this effect any of the commands I put in, or are there easier PHP commands I should use?

Thanks.

Wes

6:27 pm on Jan 7, 2004 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15756
votes: 0


You can't parse an extension for both SSI and PHP. Every time I have tried it things tend to go awry.

Either.or is fine for these types of things. If you start getting into more complex conditonal statements and doing more things I would just go with php.

6:33 pm on Jan 7, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 25, 2003
posts:664
votes: 0


OK, well thanks for your help.:)

I guess I will post that in a PHP forum and see what comes up :)

Wes