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

Your name:

Reply:


Posted by Neredbojias on 06/21/07 04:18

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><? } ?>
<li><? if ($exclude == 'page2') { ?><span
style="background:inherit;color:yellow;">Page 2</span><? } else { ?><a
href="page2.html">Page 2</a><? } ?>
<li><? if ($exclude == 'page3') { ?><span
style="background:inherit;color:yellow;">Page 3</span><? } else { ?><a
href="page3.html">Page 3</a><? } ?>
<li><? if ($exclude == 'page4') { ?><span
style="background:inherit;color:yellow;">Page 4</span><? } else { ?><a
href="page4.html">Page 4</a><? } ?>
<li><? if ($exclude == 'page5') { ?><span
style="background:inherit;color:yellow;">Page 5</span><? } else { ?><a
href="page5.html">Page 5</a><? } ?>
</ul>

All pages to contain the include ("menu") have a very similar include
link. Here's the example for page 2:

<? include 'http://www.neredbojias.com/zyxix/menu_t5.php?exclude=page2';
?>

Notice the "?exclude=" variable contains the page identifier. Otherwise,
the includes are identical.

Here's a link to a live "page 2" example incorporating the above
techniques:

http://www.neredbojias.com/zyxix/page2_t5.php

Two things I like about this are that the search/query string only has to
be on the include link, not the page link, and the styling change is
incorporated in the menu, not each page. The code could be changed a bit
if you're worried about global variables, etc.

--
Neredbojias
He who laughs last sounds like an idiot.

[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

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