Magento Change Theme Using Controller

We can change the theme using magento controller by adding below code before $this->loadLayout(); , $this->renderLayout(); . Theme update reflects only on the specific controller.

public function indexAction()
{
/* Begin - Design Package */
Mage::getSingleton('core/design_package')
                    ->setPackageName($package) // $package = base, default, {{custom_package}}, ...
                    ->setTheme($theme); //  $theme = iphone, default, {{custom_theme}}, ...
/* End */
$this->loadLayout();
$this->renderLayout();
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s