FORUMS: list search recent posts

link color question

COW Forums : Web Design

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
zachary zezimalink color question
by on Oct 1, 2010 at 4:09:00 am

http://www.laurennassef.com/category/selected-illustrations/ny-times-magazi...

When you click the site above, you will see one of the links starts off red. When you click another link, the first link goes back to black and the newly clicked link turns red. Can I do this in Dreamweaver? I'm not talking about when the links turn red due to hovering...just when clicking through. Thanks so much!

zack


Return to posts index

Fernando MolRe: link color question
by on Oct 1, 2010 at 3:29:06 pm

Theoretically, you can go page after page and color your actual page link, but in the site you posted there are tons.

I you know some server side programming language, you could compare the linked page to the actual page and if there's a match, then add a class that colors the link. If you do this in an include you'll need to do it only once.

This would be an example of a PHP function that does that:

<?php
function menup($page) {
if($_SERVER['PHP_SELF'] == $page){
echo "class=\"menuWithColor\"";
}
}
?>


Then, you add the funcion to each link in a list:

<li <?php menup("yourpage.php");?>><a href="yourpage.php">Your Page</a></li>

Just add a CSS class called menuWithColor and add your favorite color to your link.

I hope this helps

*Always share a link to your site and rate the posts. This is a free service for you and for us.


Return to posts index

zachary zezimaRe: link color question
by on Oct 2, 2010 at 3:11:32 pm

I've never used a PHP function or a list before? I tried searching for more info on php functions to figure out how to use your code, but I'm not really understanding how to make it do what I want. Any tips? Thanks a lot!!


Return to posts index


zachary zezimaRe: link color question
by on Oct 2, 2010 at 3:19:03 pm

P.S. I'm using a template, so the menu bar on the left is only editable in the template and not every page.


Return to posts index

Fernando MolRe: link color question
by on Oct 8, 2010 at 3:36:14 am

For each list item in your menu you should add the function like this:

<li <?php menup("yourpage.php");?>><a href="yourpage.php">Link to your page</a></li>


*Always share a link to your site and rate the posts. This is a free service for you and for us.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]