Magento – call other layout and block in custom phtml

blockslayoutmagento-1.9template

i want to call other layout and block in my phtml

Block Name:-catalog/product_view

Layout handle:-catalog_product_view

i have used below code but it's not working.

Mage::app()->getLayout()->createBlock('catalog/product_view');

Can any one help me on this problem ?

Any references or suggestions are highly appreciated.

Best Answer

1) On phtml files

$this->getLayout()->createBlock('core/template')->setTemplate('template path')->toHtml(); // change the block type as per your need and change the template path as well.

2) From layout xml

<your_handler>
    <block type="your block" name="name">
     <block type="core/template" name="name here" as="alias here" template="path/here/test.phtml"/>
    </block>
   </your_handler>

Now call the file inside your block. you can call like this $this->getChildHtml(alias name);

Related Topic