umpirsky wrote:
>
> I think only custom navigation partial can do this. Someone correct me if
> I'm wrong.
>
I've only ever been able to do this with a custom set of partials. Something
like this:
> <?php foreach ($pages as $page): ?>
> <li class="<?php echo $page->getClass(); ?><?php
> if ($page === end($pages)){ echo ' last-child'; } ?>">
> <a href="<?php echo
> $this->url(array('module' => $page->getModule(), 'controller' =>
> $page->getController(), 'action' => $page->getAction()), 'rest', true);
> ?>">
> <strong> <?php echo $page->getLabel(); ?> </strong>
> <?php echo $page->get('abstract'); ?>
>
> </li>
>
The important bit being:
<?php if ($page === end($pages)){ echo ' last-child'; } ?>
The "end" function sets $pages to the last element, then returns it. This
does not negatively affect the $pages of foreach because foreach works on a
copy. There are other ways to get the last item; however, end is the most
terse. The alternative is:
array_pop(array_values($pages)); // not 100% sure if this would work as the
order may not be guaranteed.
-----
--
Wil Moore III
Best Practices for Working with Open-Source Developers
http://www.faqs.org/docs/artu/ch19s02.html
Why is Bottom-posting better than Top-posting:
http://www.caliburn.nl/topposting.html
DO NOT TOP-POST and DO trim your replies:
http://linux.sgms-centre.com/misc/netiquette.php#toppost
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/How-can-I-insert-class-name-for-Zend-Navigation-generated-menu-tp1595970p3590623.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]