I'm using a XML (click here to see) with Zend_Navigation to render this:
which Menu Principal
is the first level, then Home
and Quem Somos
, then the dropdown is the third and last level. I want this last list to be dynamic (querying from the database).
I found out that I can use the method addPages($array)
i开发者_如何学编程n order to dynamically render the navigation. So I thought of querying the database for the page titles then pushing them out as arrays then use addPages()
method. I just don't know how to add pages from an existing level of the navigation.
I know how to retrieve the array I want to add, but how do I add it as Quem Somos
's list?
You may get any container by using magic methods findOneBy*()
, eg.
$submenu = $container->findOneByLabel('Quem Somos');
$submenu->setPages($yourNewContainer);
Zend Navigation implements RecursiveIterator
interface, so you may use RecursiveIteratorIterator
to iterate and find anything you want manually.
精彩评论