i have this menu:
$menu['talent'] = array(
array('id' => 'welcome',
'label' => 'My Profile',
'uri' => '/profile/,
'class' => 'navlink'
)
),
array('id' => 'welcome',
'label' => 'My Profile',
'class' => 'navlink',
'uri' => '/profile/
),
);
this will end up looking like this:
<ul>
<li><a href="" class="navlink">My Profile</a></li>
<li><a href="" class="navlink">My Profile</a></li>
<ul>
how can i change the ul
into a div
and also the li
into something else?
any idas?
Thanks
Well, to accomplish this I would use one of these two methods:
In order to overload Zend_View_Helper_Navigation_Menu
, you could write you own helper, register it and make it extends Zend_View_Helper_Navigation_Menu
. In your helper, you can overload the method you want such as _renderMenu()
and make it renders <p>
instead of <li>
for example. In your View Helper, you would have to return the parent::menu() or something like this.
Finally, you have to register this new View Helper using:
$view->addHelperPath(APPLICATION_ROOT . '/library/My/View/Helper/Navigation', 'My_View_Helper_');
This one seems to me a little bit longer, but it worth a try.
Basically, you need to set a partial script to your navigation using setPartial()
method and you menu will be rendered through this partial.
<?= $this->navigation()->menu()->setMaxDepth(2)->setPartial('partials/_nav.phtml')->render() . PHP_EOL; ?>
Afterwards, in your _nav.phtml you can render your menu as you wish. From this partial, you can access the menu variables using $this->container
. Then, you can iterate through each page of your container, and display what you want.
I know all of this seem pretty complicate for such a simple task, but unfortunately this is the only solution. Does anyone have a better idea?