I found the answer!! ;) 

this is my final result, and is working!! 

Bootstrap.php:


> <?php
> class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
> {
>       
>       public function _initLoader(){
>               $resourceLoader = new Zend_Loader_Autoloader_Resource(array(
>               'basePath'  => '../application/',
>               'namespace' => 'My',
>               ));
>       
>               $resourceLoader->addResourceTypes(array(
>                       'plugin' => array(
>                               'path'      => 'plugins/',
>                               'namespace' => 'Plugin',
>                       )
>               ));
>       }
>       
>       public function _initPlugins()
>       {
>     $front = Zend_Controller_Front::getInstance();
>     $front->registerPlugin(new My_Plugin_Layout());
>       }
> }

application/plugins/Layout.php:



> <?php
> class My_Plugin_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;
>         }
>     }
> }
> ?>
> 
> 


--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Change-layout-in-bootstrap-tp3475680p3481227.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