开发者

How to add a page inside some levels using Zend_Navigation?

开发者 https://www.devze.com 2023-01-15 22:26 出处:网络
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

I'm using a XML (click here to see) with Zend_Navigation to render this:

How to add a page inside some levels using Zend_Navigation?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消