FORUMS CLOSED DUE TO SPAM. YOU STILL CAN ADD POST!

custom link colours

Feed 2 posts, 2 voices

Avatar
2 posts

Hi,

Id like to make it so that when i click on alink on my website and load a page. the link for that page appears in an ‘active’ state. for example. i want the font to be black when im on the page, but when i click another link it changes the colour of the new link to blank.

How do i do this? i’ve tried a couple of methods with PHP but they dont seem to work, they either duplicate my navigation or or give me a fatal error message.

anyone managed to do this? how did you do it?

Many thanks in advance,

Phil

PS. i just found this http://forum.madebyfrog.com/topic/72 and tried it. but im not sure where i would need to put the code.

this is what i’ve tried with that topic. i’ve probably misread it or over looked something.

<li><a href=“index.php” title=“Welcome page”>Home<?php if(in_array($menu->slug, explode(’/’, $this->url))) { $class = “active “; }else{ $class = NULL; }?></a></li>

but when i try that i get this error

Notice: Undefined variable: navbar in /var/www/vhosts/moveinmoveout.co.uk/httpdocs/frog/app/classes/Page.php(353) : eval()‘d code on line 4

thanks.

 
Avatar
180 posts

Can you post full code of your template/snippet?

 
Avatar
2 posts

hi, sorry ive been trying to hard code it for the afternoon but i cant get it to work and the changes i had made before this topic was posted are gone now. Im discussing some options with how we want to go about tackling it.

I may end up hard coding this, but il be looking into it tonight at some point so il post my templates and files if i can.

Thanks