Reputation: 199
How to call a block in another block phtml file? I have created a module to display special product. My Question is that in featured product phtml file ,i have to check there is any special product,if present i want to display special product otherwise fetured product should be displayed.
Upvotes: 3
Views: 2110
Reputation: 2776
Create a helper class method in your custom module to check the special product condition. your helper class will return the true or false value to your module block files (.phtml).
Call the module helper calls in using below code.
Mage::helper('yourmodule')->checkSpecialProduct();
try this one.
Upvotes: 0
Reputation: 11853
you can call your custom block file in to another custom template files as below
<?php echo Mage::getSingleton('core/layout')->createBlock('custom/mycustomblock')->setTemplate('custom/test.phtml')->toHtml(); ?>
hope this will help you.
Upvotes: 1