Get current page so I can set the style to "active" in menu? |
[eluser]See64[/eluser]
I just can't find how to do this simple thing best: I am including a view called menu.php in my default view. Here I build the navigation according to your rights. This all works great, except how do I set the current page's class to something else? There is nothing in the URL helper to return the current page, and searching the forums didn't bring up anything, so I'm at a loss.
[eluser]emperius[/eluser]
are you using codeigniter? if the answer is yes than try to use http://ellislab.com/codeigniter/user-gui...s/uri.html ans than a simple "if" conditional statement if you are not using codeigniter try to use server variables
[eluser]See64[/eluser]
[quote author="emperius" date="1186600732"]are you using codeigniter? if the answer is yes than try to use http://ellislab.com/codeigniter/user-gui...s/uri.html ans than a simple "if" conditional statement if you are not using codeigniter try to use server variables[/quote] Cheers emperius, that looks like something I can use. I was looking in the wrong place: I thought this would be something like a variable called "current_class" or something. Thanks!
[eluser]mezoni[/eluser]
Code: global $class, $method; Example Navigation helper example
[eluser]See64[/eluser]
[quote author="mezoni" date="1186604163"] Code: global $class, $method; Example Navigation helper example[/quote] Thanks mezoni, but I have a disliking of globals I find that the above solution by emperius works very well, and is perhaps the easiest way. |
Welcome Guest, Not a member yet? Register Sign In |