First create alternate layout
/path/to/application/views/layouts/scripts/layout.phtml --> default layout
/path/to/application/views/layouts/scripts/admin.phtml --> admin layout
The Default layout name set in application.ini
resources.layout.layoutPath = APPLICATION_PATH “/layout/script”
resources.layout.layout = “layout”
here layout mean you have one layout.phtml file in your layout folder.
So to use different layout ,you need to create another layout file in your layout folder as admin.phtml
$this->_helper->layout->setLayout('admin');
Now you can call your alternate layout with above mention function on controller.
Full example
<?php
class IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$this->_helper->layout->setLayout('admin'); //set alternate layout
}
public function userlistAction()
{
//default layout will be called
}
}
/path/to/application/views/layouts/scripts/layout.phtml --> default layout
/path/to/application/views/layouts/scripts/admin.phtml --> admin layout
The Default layout name set in application.ini
resources.layout.layoutPath = APPLICATION_PATH “/layout/script”
resources.layout.layout = “layout”
here layout mean you have one layout.phtml file in your layout folder.
So to use different layout ,you need to create another layout file in your layout folder as admin.phtml
$this->_helper->layout->setLayout('admin');
Now you can call your alternate layout with above mention function on controller.
Full example
<?php
class IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$this->_helper->layout->setLayout('admin'); //set alternate layout
}
public function userlistAction()
{
//default layout will be called
}
}
No comments:
Post a Comment