TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

Zapping it Colors

Page: 1 Reply
Aug 13th 2004#158388 Report
Member since: Jun 22nd 2002
Posts: 184
Hi, you know how some sites have links like this
News - Forum - About
and it's all black, but then when you click on lets say About, you go to that page, and suddenly, on that page, the link about is highlight RED
Does anyone know how I can dynamically do this? I can still use php includes to ease the editing load, but each time I create a new section I have to go and add it to all the pages. Thanks
Reply with Quote Reply
Aug 13th 2004#158404 Report
Member since: Apr 20th 2002
Posts: 3000
If you're using seperate PHP files for each section, then in the navigation include have it check the file name and highlight the appropriate link. There are several ways of doing it, the method that I can think of off the top of my head would be:
[php]

$highlight = ""; // Highlight color
$sections = array("News", "Forum", "About"); // Array containing section names as it will appear on the page
$sep = " - "; // Seperator

$script_name = $_SERVER["PHP_SELF"];
if (eregi("news"), $script_name)) $sections[0] = $highlight.$sections[0]."
"; // Checks script name for a string pattern
else if (eregi("forum"), $script_name)) $sections[1] = $highlight.$sections[1].""; // and highlights the appropriate one
else if (eregi("about"), $script_name)) $sections[2] = $highlight.$sections[2]."";
...

for ($i = 0; $i < count($sections) - 1; $i++) echo $sections[$i].$sep;
echo $sections[count($sections) - 1];

?>
[/php]

I haven't tested this bit of code, but you'll get the idea.
Reply with Quote Reply
Aug 13th 2004#158416 Report
Member since: Jun 22nd 2002
Posts: 184
Thanks man
Reply with Quote Reply
Page: 1 Back to top
Please login or register above to post in this forum