Navigation question |
[eluser]copernicus[/eluser]
I have a database that I have my pages in and want to make a navigation menu that builds an unordered list of the pages that have a menu_title value. I want to have it so whatever page you are on, the corresponding menu item in the navigation is "active" (background color is different or something). How would I go about doing this if I know the active page and have it in a variable? I assume I need some call to the database and compare the menu_titles to the active page variable? Where is the best place to put a function like this?
[eluser]thinkigniter[/eluser]
What I would do is... In your View create a javascript variable like so. Code: var active = '<?php echo $active_page; ?>'; This sets the active page via your controller to whatever is stored in the php variable Code: $active_page Now design your menu using a jquery plugin of your choice http://plugins.jquery.com/project/Plugins/category/44. And your done. |
Welcome Guest, Not a member yet? Register Sign In |