Finding if the current page is in a Zend Navigation object
I have more than one Zend_Navigation
object in my application. I want to do a test to find out which object holds the page I'm currently on. I didn't see methods for doing that in the documentation. Can this be accomp开发者_StackOverflow中文版lished? How?
Thanks!
AFAIK there is no public method to do compare all pages in the container recursively at once.
You may implement your own method iterating all the pages and the subpages in the container (Zend_Navigation
implements RecursiveIterator
) and check $container->isActive()
status or compare container params with the current $request->getParams();
.
I ended up using the findById()
function after using some logic very specific to my implementation to determine which navigation object applied to the current request.
精彩评论