cancel
Showing results for 
Search instead for 
Did you mean: 

How can i insert custom phtml.file to contact page?

SOLVED

How can i insert custom phtml.file to contact page?

I create a phtml file which clone the original contact form. And i would insert this file to contact page.

My contact form urlkey is 'contacts'. In the result, we can see the contact form at mysite/contacts

btw how can i add the new phtml file in contact.xml file? i added like this,

 

 

/app/design/frontend/rwd/default/layout/contact.xml

 

<layout version="0.1.0">
<contacts_index_index translate="label">
    <label>Contact Us Form</label>
    <reference name="head">
        <action method="setTitle" translate="title" module="contacts"><title>Contact Us</title></action>
    </reference>
    <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
        <action method="setHeaderTitle" translate="title" module="contacts"><title>Contact Us</title></action>
    </reference>
    <update handle="cms_menu"/>
    <reference name="content">
        <block type="core/template" name="contactForm" template="contacts/form.phtml"/>
        <block type="core/template" name="contactForm" template="contacts/clone-form.phtml"/> //this one is what i insert in
    </reference>
</contacts_index_index>

 

 

4 REPLIES

Re: How can i insert custom phtml.file to contact page?

You replace from.phtml with your file abc.phtml just

 

change

 <reference name="content">
        <block type="core/template" name="contactForm" template="contacts/form.phtml"/>
    </reference>

 To

 

 <reference name="content">
        <block type="core/template" name="contactForm" template="foldername/abc.phtml"/>
    </reference>
Find helpful ? Consider Giving Kudos to this post.
Problem solved? Click Accept as Solution!"
Qaisar Satti

Re: How can i insert custom phtml.file to contact page?

I wanna put two phtml files at this code! 

Re: How can i insert custom phtml.file to contact page?

Hi guy,

We are have two way to do it.

1. pleae change name of the new form that you added, example: name = "contactFormAdd"

so your code will be: 

 <block type="core/template" name="contactFormAdd" template="contacts/clone-form.phtml"/> 

 2. in the contacts/form.phtml file, please add this code at footer:

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('contacts/clone-form.phtm') ->toHtml().

 

Hope that will help you.

 

Re: How can i insert custom phtml.file to contact page?

Hi guy,

We are have two ways to do it.

1. pleae change name of the new form that you added, example: name = "contactFormAdd"

so your code will be: 

 <block type="core/template" name="contactFormAdd" template="contacts/clone-form.phtml"/> 

 2. in the contacts/form.phtml file, please add this code at footer:

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('contacts/clone-form.phtm') ->toHtml().

 

Hope that will help you.