I’ve recently started working with Zend Framework and I’ve absolutely fallen in love with it and I’ve even decommissioned my own framework in favour of it.
But I’m missing something that is probably so painfully obvious you’ll chuckle a little bit.
I have a login system and in every controller I have to put the check for the login status, I had a look at accessing the Zend Session Storage in the Bootstrap but I’m on bit of a deadline and can’t afford to waste time, is there a better way to check IE in the bootstrap? instead of repeating 20+ lines of code and functionality in every controller.
Thanks in advance!
You can use a controller plugin for this. See: http://framework.zend.com/manual/en/zend.controller.plugins.html
replace the controller/action names with whatever is appropriate for your login page, and ‘Your’ with your application’s namespace.
You then register the plugin with the Front controller either in application.ini or in your bootstrap with
Zend_Controller_Front::getInstance()->registerPlugin(new Your_Plugin_Login());.Edit: If you want to put the user details in the view as well, you can do: