1

My zend application structure:

application
  ->configs
  ->layouts
     ->scripts
        ->admin.phtml
        ->site.phtml
  ->modules
     ->admin(controllers, models, views)
       ->Bootstrap.php
     ->default(controller,models,views) 
       ->Bootstrap.php

I have set the default layout in my application.ini as:

resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.layout.layout = "site"

I have two modules: admin and default. How to set the layout file (admin.phtml)for admin module? I want to change the layout from admin module's Bootstrap.php file? Or suggest me which is most easy way?

rockstar
  • 1,322
  • 1
  • 20
  • 37

1 Answers1

1

Write this in your Bootstrap.php in the admin folder:

protected function _initLayout()
{
   $layout = Zend_Layout::getMvcInstance();
   $layout->setLayout('admin');
}

With the above two lines you can also change the layout in Controllers and Plugins. If you want to change it in a view, you can do that so:

<?php $this->layout()->setLayout('admin'); // set alternate layout ?>
ByteNudger
  • 1,545
  • 5
  • 29
  • 37