I'm using RecursiveIteratorIterator
to loop over Zend_Navigation
, which is basically a list of nested <ul>
and <li>
tags:
$iterator = new RecursiveIteratorIterator(
$container,
RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($iterator as $page) {
...
// isLast()?
// isFirst()?
}
How to determine, whether the currently iterated element ($page
) is first or last element on current level?
I need to add first
and last
class attribute to those elements.