Reply to Re: Change color of links that have a target of the page on which they are found.

Your name:

Reply:


Posted by Adrienne Boswell on 06/21/07 05:13

Gazing into my crystal ball I observed Rich Bradshaw
<Rich.Bradshaw@gmail.com> writing in news:1182365867.888535.188240
@k79g2000hse.googlegroups.com:

> Hi,
>
> Sorry about the long title - I have a page with a navbar on. I would
> like like to make it so that the links that link to the page the user
> is on are a different color.
>
> The problem is, that I want to keep the menu in a file so that I can
> server side include it, so I don't want to have to change it manually
> for each page.
>

This is what I do, and it works very well. At the top of each page:

$thispage = "The title of the page, for title and first level heading";
$thisurl = "theactualurl.php";

Then as I loop through the menu, if the url of the menu item is the same
as $thisurl, then it gets a class of current page, and is styled
accordingly.

The reason that I assign it a class is that I might have a menu on the
bottom of the page as well, and as it might use a different div id, the
class can be used again, and could, or could not be styled diffently, eg;

ul#menu.current {border:1px solid #000;}
ul#footer.current {border:1px dotted #000;}

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация