First, you build your ACL where you define something like a user (logged in) and a guest (not logged in). You can allow or deny users or guest certain resources, and a Zend_Navigation_Page could be one of those resources. So, when your navigation is rendered, and a certain page is defined as a resource in your ACL, Zend_Navigation will check the ACL if the current user has the rights to view that page.
You will have to keep in mind that this ACL checking is only done on the navigation itself, and not on the specific controller/action when it is requested. So, the link to the logout page is hidden when someone is not logged in, but that does not mean a guest cannot visit the logout page.
If you do a web search on Zend_Navigation Zend_Acl you will find a lot of examples that will get you started.
Jelle-Jan
From: Jigal sanders [mailto:jigalroecha@gmail.com]
Sent: zondag 21 maart 2010 21:16
To: fw-general; fw-mvc
Subject: [fw-mvc] Conditional links in Zend_Navigation
Hello,
I use Zend_Navigation and an xml file to build up my navigation.
Is it possible to show only a link on a certain condition? For example when a user is logged in i want to show the logout link but when no one is logged in i don't want to show the logout link.
Any idea's?
Thanks.
J. Sanders
没有评论:
发表评论