notDeadYet Posted October 5, 2006 Share Posted October 5, 2006 Hello,I'm a n00bie with php. This is the end result that I want: I want my navigation links to be able to detect what page it is on and then leave that link in the "on" state - oh the home page, the "home" link is in the on state. I want to do this so I only need one nav text file to use as an include.I was thinking on using switch statements (did I say that right?). I'm using images for the links, so I would need it to swap images. I'm on the edge of figuring ou how to do that but I need a push!If I use this code:[pre]<?php?pageName = "faq"; // name of this pageswitch ($link) {case "icf";echo = "images/icf_on.jpg";break;case "products";echo = "images/products_on.jpg";break;case "events":echo = "images/events_on.jpg";break;case "projects":echo = "images/projects_on.jpg";break;case "faq":echo = "images/faq_on.jpg";break;}?>[/pre]then, I'm not sure what to put for the echo. What would the html nav file use to determine the correct link to leave "on"?Like I said, I'm new at this and I've gotten myself confused. I know someone can help me - thank!Sherill Quote Link to comment Share on other sites More sharing options...
phporcaffeine Posted October 5, 2006 Share Posted October 5, 2006 I'm not all that sure what you are looking for but try something like this:<?phpif ($_GET['detectable_variable'] == "Some Value") { echo "the 'on' state link text";}else { echo "the 'off' state link text";}?> Quote Link to comment Share on other sites More sharing options...
notDeadYet Posted October 5, 2006 Author Share Posted October 5, 2006 My thinking was to make the variable the page name, define that at the top and then the case statements determine what is supposed to happen for that particular page. I'm not sure what the switch variable would be..... switch (?pageName) ?What would the echo statments look like if the links are images, no text at all, and then how do I call that in the html nav file? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.