Friday, May 8, 2015

Magento -Change page layout from controller

You need to replace one line of code in your controller
where you want to change the layout of the page if you are not
able to do from xml through setlayout.

Replace
$this->loadLayout();

with
$this->loadLayout()->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');

No comments :

Post a Comment