Magento 1.9 : Change page layout from controller

Just we need to replace one line of code in our controller where we want to change the layout of the page if we 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