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

Your name:

Reply:


Posted by rf on 06/21/07 14:30

"Neredbojias" <neredbojias@gmail.com> wrote in message
news:Xns9955D8CEFCFBBnanopandaneredbojias@198.186.190.161...
> On Wed, 20 Jun 2007 21:35:54 GMT Rich Bradshaw scribed:
>
>> Ok, got it working using the CSS method - nice and neat. Just used a
>>
>> <style type="text/css"><!--
>> a#home {
>> color: white !important;
>> }
>> --></style>
>>
>> In the header on the home page, changing home as relevant. Each link
>> on navbar has id="XXX" in it, where XXX would be home for this page.
>>
>> Simple.
>>
>> Thanks very much!
>
> After reading Beauregard's and BootNic's advices, I decided mine rather
> suck... er, was inelegant. Ergo, I tried something better.
>
> For example:
>
> Your "menu" page to be included could look something like this:
>
> <ul>
> <li><? if ($exclude == 'page1') { ?><span
> style="background:inherit;color:yellow;">Page 1</span><? } else { ?><a
> href="page1.html">Page 1</a><? } ?>

<searches archives for things I used to do>

$page =
array_shift(explode('.',array_pop(explode('/',$_SERVER['PHP_SELF']))));



echo "<ul>\r\n";
echo ($page == "page1") ? "<li><span>Page 1</span></li>\r\n" : "<li><a
href='page1.php'>Page 1</a></li>\r\n";
echo ($page == "page2") ? "<li><span>Page 2</span></li>\r\n" : "<li><a
href='page2.php'>page 2</a></li>\r\n";
echo "</ul>\r\n";

Watch the wrap.

Style the <span>s and the <a>s to taste.

Next stage is to wrap it up in a nice pretty function.



--
Richard (nine hours behind)

[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

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