Multiple layouts in zend framework
In my site I want two layouts.
- Main layout comes when no login.
- Whenever a user logs in there will be 1 more layou开发者_高级运维t inside 1st with menu for account changes etc.
Can anyone explain how can we do it.?
If you just want to change the navigation for logged in/not logged in users, look into role privileges in zend_navigation_page
http://framework.zend.com/manual/en/zend.navigation.pages.html
Several options.
One is to use a pre-dispatch front controller plugin. Simply check Zend_Auth to see if user is logged in. If so, then set the layout to the 'logged-in' layout, else leave as default layout.
Another option is to check Zend_Auth from inside your actual layout file, and only include the additional code/formatting if they are logged in.
精彩评论