php - How do I apply class="current" to an <a href=...> tag when using Zend_Navigation? -



can read title, i'm trying add class="current" part html anchor tag zend_navigation renders.

here's have:

bootstrap.php

protected function _initnavigation(){          $this->bootstrap('layout');          $layout = $this->getresource('layout');          $view = $layout->getview();          $config = new zend_config_xml(application_path .'/configs/navigation.xml','nav');          $navigation = new zend_navigation($config);          $navigation->current()          $view->navigation($navigation);      }  

and in view script:

<div class="navmenu">   <?= $this->navigation()->menu(); ?> </div> 

i’m pretty sure there’s standard , proper way of doing it, after couple hours of search, i’m unable find answer. many kind help.

stick in controller...

public function init() {             $uri = $this->_request->getpathinfo();                       $activenav = $this->view->navigation()->findbyuri($uri);             $activenav->active = true;             $activenav->setclass("active"); } 

for more information read comments of setclass method in zend_navigation_page

http://framework.zend.com/svn/framework/standard/trunk/library/zend/navigation/page.php


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -