How to call the another phtml template file. For example if you want to call the coupon code. First we will need go to the checkout.xml file which is located at app >> code >> design >> THEME NAME >> default >> layout >> checkout.xml. After that look for the coupon html file then you will find below code.
<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
You will can see that block type=”checkout/cart_coupon” as namespace/module_page. So lets call this block from another block. Below code can be used to call that block.
<?php echo $this->getLayout()->createBlock('checkout/cart_coupon')->setTemplate('checkout/cart/coupon.phtml')->toHtml(); ?>
As you can see createBlock(‘checkout/cart_coupon’) which is used from block type=”checkout/cart_coupon” and setTemplate(‘checkout/cart/coupon.phtml’) which is used from the template=”checkout/cart/coupon.phtml”.
Note : The above code will only work on the phtml file only.
If you have enable cache management then clear the magento cache and check the page. The code will work perfectly.
I hope this helped you. THANK YOU.