I have one problem with implementation of menus using Zend_Navigation
and Menu view helper.
I have a hierarchically (2+ levels) menu. Most of the menu items are
based based, and couple are url based. For grouping the items from level
2 i am using some "empty" nodes on level 1, which are basically some url
menu items, with # as href. This is a very often case for drop down
menus or so, so could be rendered fine both with Javascript or without
(with just CSS).
Let's see a menu sample:
About Us (with # as url)
- About Us (mvc)
- Contact (mvc)
- Jobs (mvc)
- Blog (url)
Support (with # as url)
- List tickets (mvc)
- New ticket (mvc)
Each mvc item has associated resource and privilege, and at view helper
i am setting the acl and current role.
Now, here is my problem. Let's suppose the use doesn't have access to
both "List tickets" and "New ticket". The view helper is rendering the
"Support" (with # as url) and of course there are no subitems to be
rendered...
This looks odd by many reasons... So the problem is: how should i make
the view helper to NOT render also "Support" if the child pages are not
rendered.
There are couple of possible solutions:
- use custom partial script to render menu
- add an assert for the "empty" menu items to check if subitems would be
rendered or not and decide by this
- maybe even other solutions...
But i wannt to see what approach are you using for such problems...
--
Best regards,
Cristian Bichis
www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com
没有评论:
发表评论