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 <[email protected]> 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: [email protected]
> Info: http://framework.zend.com/archives
> Unsubscribe: [email protected]
>
>
>

Reply via email to