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?
只要XML块正确放置,在phtml文件中你就应该能够将它带出来:
<?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
:
So simple, I know, but took me 3 coffees like all easy things in magento...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.