I want to override the contact page frontend from my module file.
To override the frontend template of contact form, i have created module and in that module i have created layout file mymodule.xml in app/design/frontend/base/layout/mymodule/mymodule.xml in this file i have copied following code:
<layout version="0.1.0">
<contacts_index_index translate="label">
<label>Contact Form</label>
<reference name="head">
<action method="setTitle" translate="title" module="contacts"><title>Contact You 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="mymodule/form.phtml"/>
</reference>
</contacts_index_index>
</layout>
I did following code in my module's xml file but it doesn't loading from my module. What could be the issue?
Any help would be appreciated
-
so your custom contact phtml should display for your custom action or in all page?kunj– kunj2018年07月26日 06:44:50 +00:00Commented Jul 26, 2018 at 6:44
2 Answers 2
You have to first add your "mymodule.xml" file in yourmodule/etc/config.xml file like below:-
<layout>
<updates>
<contacts>
<file>mymodule.xml</file>
</contacts>
</updates>
</layout>
After that you have to add your code in mymodule.xml file. You have to also create form.phtml file and put that file in app/design/frontend/base/template/mymodule/form.phtml. Hope it works.
Create "local.xml" under "app/design/frontend/themepackage/theme/layout".
Add below lines of code.
<?xml version="1.0"?>
<layout version="0.1.0">
<contacts_index_index translate="label">
<reference name="content">
<block type="core/template" name="contactForm" template="contacts/custom_contact.phtml"/>
</reference>
</contacts_index_index>
</layout>
Explore related questions
See similar questions with these tags.