• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get current page so I can set the style to "active" in menu?

#1
[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.

#2
[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

#3
[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!

#4
[eluser]mezoni[/eluser]
Code:
global $class, $method;
variables help you to solve this problem.

Example Navigation helper example

#5
[eluser]See64[/eluser]
[quote author="mezoni" date="1186604163"]
Code:
global $class, $method;
variables help you to solve this problem.

Example Navigation helper example[/quote]

Thanks mezoni, but I have a disliking of globals Wink I find that the above solution by emperius works very well, and is perhaps the easiest way.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.