You can do this by magento event Observer
Create an event on controller_action_layout_load_before and add a new template on this events and
See more at
https://stackoverflow.com/questions/7123483/conditionally-add-blocks-in-magento-layout http://blog.mattstephens.co.uk/post/26827632719/adding-a-custom-layout-xml-handle-in-magento
Step1:Add this at config.xml code is like
<frontend> <events> <controller_action_layout_load_before> <observers> <add_new_block> <class>CUSTOM_MODULE/observer</class> <method>beforeLoadLayout</method> </add_new_block> </observers> </controller_action_layout_load_before> </events> </frontend>
Step2: create a new block
$block = $this->getLayout()->createBlock( 'Mage_Core_Block_Template', 'my_block_name_here', array('template' => 'activecodeline/developer.phtml') );
Study:http://inchoo.net/magento/programatically-create-magento-blocks-and-inject-them-into-layout/
Step3: then append it on event your reference block and code
public function beforeLoadLayout($observer) { if( Mage::app()->getRequest()->getParam('minified')=='yes') $block = $this->getLayout()->createBlock( 'Mage_Core_Block_Template', 'my_block_name_here', array('template' => 'activecodeline/developer.phtml') ); /* new block at content area */ $observer->getEvent()->getLayout()->getUpdate()->getBlock('content')->append($block); } }