how to add a new phtml file into another file
-
12-12-2019 - |
Question
I added like that in page.xml
<block type="page/html_banner" name="banner" as="banner" template="page/html/banner.phtml">
</block>
but didn't get the template.
please any one suggest me.
Solution
<block type="page/html_banner" name="banner" as="banner" template="page/html/banner.phtml">
<block type="page/html_banner" name="custom" as="custom" template="page/html/custom.phtml">
</block>
In banner.phtml you can call $this->getChildHtml('custom');
to access custom.phtml inside banner.phtml
(or)
Try the below code inside banner.phtml,
$this->getLayout()->createBlock('page/html_banner')->setTemplate('page/html/custom.phtml')->toHtml();
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange