If you want get code like this:
<ul id="main_nav"> <li><a href="/users/account' class="active">My account</a></li> <li><a href="/items/browse'>Browse</a></li> <li><a href="/items/add' class="active">Create item</a></li> <li><a href="/users/add' class="active">Create User</a></li> </ul>
You can use useful ;) helper - Navigation Helper!
Code like this:
<?$navigation->link('My account',"/users/account/",array('activeAction'=>'account'))?>
<?$navigation->link('Browse',"/items/browse/",array('activeAction'=>'browse'))?>
<?$navigation->link('Create Item',"/items/add/",array('activeAction'=>'add','activeController'=>'items'))?>
<?$navigation->link('Create Item',"/users/add/",array('activeAction'=>'add','activeController'=>'users'))?>
So... When user travel into your site and change /items/add -> users/add - the different menu be displayed (class = "active" I mean).
Just add code like this
<?php echo $navigation->render(null,array('id'=>'main_nav'))?>
In your views! ;-)
Easy Way? Yes! Easy!
You can find more detail information here. And download navigation helper (sorry it's not direct link, because this file present in other blog).
The link seems to be dead :-(
ReplyDeleteAnd I can't find another copy of this helper on the internet!!
Do you know where else I could get it from? Or do you have a copy which you could email to me?
Thanks a lot!
Ollie.