Re: [fw-general] Re: Change layout in bootstrap
Also remove any code you added to your bootstrap.php file that attempts to load this plugin. -- *Hector Virgen* Sr. Web Developer http://www.virgentech.com On Wed, Apr 27, 2011 at 10:40 AM, ratclot wrote: > the same error: > > Fatal error: Class 'Plugin_Layout' not found in > /home/zerego/application/Bootstrap.php on line 8 > > i change de layout.php to: > > class Default_Plugin_Layout extends Zend_Controller_Plugin_Abstract > > and put the resources.frontController.plugins.layout = > "Default_Plugin_Layout" in the ini > > :S > > > -- > View this message in context: > http://zend-framework-community.634137.n4.nabble.com/Change-layout-in-bootstrap-tp3475680p3478908.html > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- > List: fw-general@lists.zend.com > Info: http://framework.zend.com/archives > Unsubscribe: fw-general-unsubscr...@lists.zend.com > > >
Re: [fw-general] Re: Change layout in bootstrap
Rename your class to "Default_Plugin_Layout" (keeping the same file name) and place this line in your application.ini: resources.frontController.plugins.layout = "Default_Plugin_Layout" -- *Hector Virgen* Sr. Web Developer http://www.virgentech.com On Wed, Apr 27, 2011 at 10:15 AM, ratclot wrote: > Thanks for your answer. But now i have an error calling de plugin: > > Fatal error: Class 'Plugin_Layout' not found in > /home/zerego/application/Bootstrap.php on line 8 > > application/plugins/Layout.php: > >class Layout extends Zend_Controller_Plugin_Abstract >{ >public function preDispatch() >{ >$user = Zend_Auth::getInstance(); >$role = $user->getIdentity()->role; >$layout = Zend_Layout::getMvcInstance(); > >switch ($role) { >case 'admin': >$layout->setLayout('layout2'); >break; > >case 'normal': >$layout->setLayout('layout'); >break; > >default: >$layout->setLayout('layout'); >break; >} >} >} > > application/Bootstrap.php: > > >class Bootstrap extends Zend_Application_Bootstrap_Bootstrap >{ >protected function _initPlugins() >{ >$front = Zend_Controller_Front::getInstance(); >$front->registerPlugin(new Plugin_Layout()); >} >} > > > Sorry but i´m learning zend and OOP by my self. If you can help me again... > :D > > > -- > View this message in context: > http://zend-framework-community.634137.n4.nabble.com/Change-layout-in-bootstrap-tp3475680p3478808.html > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- > List: fw-general@lists.zend.com > Info: http://framework.zend.com/archives > Unsubscribe: fw-general-unsubscr...@lists.zend.com > > >
Re: [fw-general] Re: Change layout in bootstrap
Don't use a parent controller. This is a bad idea! Use a plugin: http://framework.zend.com/manual/en/zend.controller.plugins.html This blog post will also help: http://weierophinney.net/matthew/archives/234-Module-Bootstraps-in-Zend-Framework-Dos-and-Donts.html Am 27.04.2011, 17:04 Uhr, schrieb benoit : I don't know if there is a way in bootstrap, but you can create a ParentController, which extends Zend_Controller_Acion, and your application controllers extend ParentController. In parentController's preDispatch hook, you can do: public function preDispatch() { if (Zend_Auth::getInstance()->hasIdentity()): $this->_helper->layout->setLayout('layout2'); } } -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Change-layout-in-bootstrap-tp3475680p3478403.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com