I have disabled layout for the wishlist block:
<block type="catalog/product_view" name="product.info.addtoto" as="addtoto" template="catalog/product/view/addto.phtml"/>
I now want to call that block in the phtml instead of add it to another layout.
How do I call it directly?
Except for displaying CMS block on CMS Page or CMS Block, showing it on category page there is an option to call CMS block programmatically using XML file. You need to replace "my_cmsblock_identifier" with your CMS block Identifier or ID (we recommend to use Identifier).
While Prattski is correct that this is poor form (am I'm upvoting as such), there have been times when developing when either this has been a valuable debugging technique, or it made the difference of several hours of programming. In that spirit, this is the bad habit way of doing it:
<?php print $this->getLayout()
->createBlock("catalog/product_view")
->setTemplate("catalog/product/view/addto.phtml")
->toHtml(); ?>
Use sparingly, if at all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With