更改Magento中联系表单的列布局

时间:2010-07-23 00:27:53

标签: magento

在哪里可以更改Magento中默认联系页面的列布局(左侧2列,右侧2列等)?

感谢

3 个答案:

答案 0 :(得分:17)

首先,确定联系页面的“布局句柄”。如果this是您正在讨论的页面,那么您的布局句柄是

contacts_index_index

接下来,在layout.xml文件中找到布局句柄

<contacts_index_index translate="label">
    <label>Contact Us Form</label>
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
        <action method="setHeaderTitle" translate="title" module="contacts"><title>Contact Us</title></action>
    </reference>
    <reference name="content">
        <block type="core/template" name="contactForm" template="contacts/form.phtml"/>
    </reference>
</contacts_index_index>

更改setTemplate调用以引用模板

<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>

或者,将句柄引用添加到local.xml文件中。 local.xml文件最后应用,所以无论进入什么“赢”

<layout>
    <contacts_index_index>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>    
        </reference>
    </contacts_index_index>
</layout>   

答案 1 :(得分:6)

联系人页面的布局在contacts.xml中设置。因此,另一种方法是:

1.在基本布局文件夹中找到contacts.xml 2.复制该文件中的内容
3.在模板的布局文件夹中创建一个新的contacts.xml文件 4.粘贴该文件的内容,找到设置默认布局的行

<reference name="root">
   <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
   <action method="setHeaderTitle" translate="title" module="contacts"><title>Contact Us</title></action>
</reference>

5。将该行更改为您希望默认布局为

的任何内容
<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>

6。保存,它会覆盖默认布局

答案 2 :(得分:1)

首先,在基本布局文件夹中找到contacts.xml,然后在41行中找到

更改此代码
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>

<action method="setTemplate"><template>page/2columns-left.phtml</template></action>