Welcome Guest, Not a member yet? Register   Sign In
Automatically add a class to link for active page?
#2

[eluser]rogierb[/eluser]
I wrote a helper function that takes an array of links and checks them against the current URI. If a link matches, it adds a class: "active" to that link. An extension has been build to accomodate for submenu's,which is a whole different story

I guesss in your case, just pass the anchor to a helper function:
<code>Check_for_current_uri(anchor("some_controller/some_method/var1/var2", "title", array("class"=>"replace_this_with_active_class")))</code>

In that function check the current uri to the one in the link. Is it matches, replace the class, if not do nothing or remove the bogus class


Messages In This Thread
Automatically add a class to link for active page? - by El Forum - 10-05-2009, 02:52 AM
Automatically add a class to link for active page? - by El Forum - 10-05-2009, 03:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB