Zend Layouts for Default and Admin

3 messages Options
Embed this post
Permalink
Opel

Zend Layouts for Default and Admin

Reply Threaded More More options
Print post
Permalink
I have set up my app directory as follows :

application
---- modules
---- templates
---------default
---------admin
---- models
library


What I am trying to do is use default template for my public view and admin template for the admin module. I need to set my bootstrap up to switch the template for that single "admin" module. This was covered in Padraic Brady's tutorial but seems to have been taken down and I didn't have a copy of the source.

Could anyone advice me how to do this. The searches on forum for answers all seem to be different layouts per module.
Timo Ziemann

Re: Zend Layouts for Default and Admin

Reply Threaded More More options
Print post
Permalink
You could register a plugin which sets the alternative layout if the module is == admin...

For example:
if($request->getModuleName() == 'admin')
    Zend_Layout::getMvcInstance()->setLayout('alternative');

Opel wrote:
I have set up my app directory as follows :

application
---- modules
---- templates
---------default
---------admin
---- models
library


What I am trying to do is use default template for my public view and admin template for the admin module. I need to set my bootstrap up to switch the template for that single "admin" module. This was covered in Padraic Brady's tutorial but seems to have been taken down and I didn't have a copy of the source.

Could anyone advice me how to do this. The searches on forum for answers all seem to be different layouts per module.
Matthew Lurz

Re: Zend Layouts for Default and Admin

Reply Threaded More More options
Print post
Permalink
In reply to this post by Opel
In case you are still looking for a solution:

class My_Layout_Controller_Plugin_Layout extends Zend_Layout_Controller_Plugin_Layout
{
    public function preDispatch(Zend_Controller_Request_Abstract $request)
    {
        $module = $request->getModuleName();
        if ('admin' == $module) {
          $this->getLayout()->setLayout($module);
        }
    }
}

Opel wrote:
I have set up my app directory as follows :

application
---- modules
---- templates
---------default
---------admin
---- models
library


What I am trying to do is use default template for my public view and admin template for the admin module. I need to set my bootstrap up to switch the template for that single "admin" module. This was covered in Padraic Brady's tutorial but seems to have been taken down and I didn't have a copy of the source.

Could anyone advice me how to do this. The searches on forum for answers all seem to be different layouts per module.