How to render a block in magento .phtml file?
I am trying to render the magento contact form into a .phtml file, but I cannot find anything on Google to get the PHP code to do it.
I only know the code to use in magento's CMS system which is:
{{block type="core/template" name="contactForm" form_action="/contacts/index/post" 开发者_运维技巧template="contacts/form.phtml"}}
Any clues?
As long as the XML block is placed correctly, in a phtml file you should be able to bring it out with:
<?php echo $this->getChildHtml('contactForm') ?>
If you want to have the contact form with in a phtml
page then...
add the block to the xml you want for example I wanted to add a request form to the product view so, i went to catalog.xml at the
<reference name="content">
and add:<block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"/>
just add the
getChildHtml('contactForm') ?>getChildHtml
:
So simple, I know, but took me 3 coffees like all easy things in magento...
精彩评论