开发者

Multiple layouts in zend framework

开发者 https://www.devze.com 2023-01-23 01:24 出处:网络
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.

In my site I want two layouts.

  1. Main layout comes when no login.
  2. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号