在magento中新建并调用一个布局文件
来源:互联网 发布:淘宝极速贷款 编辑:程序博客网 时间:2024/06/06 07:29
magento中默认的布局文件为1column.phtml,2columns-left.phtml,2columns-right.phtml,3columns.phtml
其实我们是可以增加自己需要的布局文件的。页面的内容具体要什么样子的,这就看自己的需求了。增加magento布局文件的方法步骤如下。
一、新建一个布局文件newcolumn.phtml 这个newcolumn.phtml根据自己的需要进行设置。大体和默认的几个布局文件的结构一致,调用的内容块一致就ok了。
二、在layout/page.xml中标签里加以下代码,可以参考默认的几个布局文件。
<page_new_columns translate="label">
<label>All new-Column Layout Pages</label>
<reference name="root">
<action method="setTemplate"><template>page/newcolumn.phtml</template></action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
</reference>
</page_new_columns>
三、在code/core/mage/page/etc/config.xml中这个标签里 <page>下的 <layouts>里加入以下代码,同样有其他布局文件的写法,(可以参考其他的布局写法)
<new_columns module="page" translate="label">
<label>new column</label>
<template>page/newcolumn.phtml</template>
<layout_handle>page_new_columns</layout_handle>
</new_columns>
完成上述的几步之后,在Magento后台选择layout的时候 就会多一项new cloumn的选项。或者是要通过设置catalog.xml在需要调用到该布局文件的地方改成相应的标签就ok了。例如需要在Product view 页面调用该布局文件可以修改
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
成相应的
<reference name="root">
<action method="setTemplate"><template>page/newcolumn.phtml</template></action>
</reference>
这样在product view页面就调用了新的布局文件了。这样就给我们前台设计带来的更大的方便。可以根据我们的需要来设定magento的前台显示结果。
magento中默认的布局文件为1column.phtml,2columns-left.phtml,2columns-right.phtml,3columns.phtml
其实我们是可以增加自己需要的布局文件的。页面的内容具体要什么样子的,这就看自己的需求了。增加magento布局文件的方法步骤如下。
一、新建一个布局文件newcolumn.phtml 这个newcolumn.phtml根据自己的需要进行设置。大体和默认的几个布局文件的结构一致,调用的内容块一致就ok了。
二、在layout/page.xml中标签里加以下代码,可以参考默认的几个布局文件。
<page_new_columns translate="label">
<label>All new-Column Layout Pages</label>
<reference name="root">
<action method="setTemplate"><template>page/newcolumn.phtml</template></action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
</reference>
</page_new_columns>
三、在code/core/mage/page/etc/config.xml中这个标签里 <page>下的 <layouts>里加入以下代码,同样有其他布局文件的写法,(可以参考其他的布局写法)
<new_columns module="page" translate="label">
<label>new column</label>
<template>page/newcolumn.phtml</template>
<layout_handle>page_new_columns</layout_handle>
</new_columns>
完成上述的几步之后,在Magento后台选择layout的时候 就会多一项new cloumn的选项。或者是要通过设置catalog.xml在需要调用到该布局文件的地方改成相应的标签就ok了。例如需要在Product view 页面调用该布局文件可以修改
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
成相应的
<reference name="root">
<action method="setTemplate"><template>page/newcolumn.phtml</template></action>
</reference>
这样在product view页面就调用了新的布局文件了。这样就给我们前台设计带来的更大的方便。可以根据我们的需要来设定magento的前台显示结果。
- 在magento中新建并调用一个布局文件
- 在magento中新建并调用一个布局文件
- Magento中新建一个布局文件(自定义布局文件)
- 在SQLServer2005中,新建一个用户,并分配一个角色
- Android--在手机SD卡上新建一个自定义文件夹并在新建文件夹目录下新建一个文件
- 如何在VB中打开一个Excel文件并调用Excel文件自身的VBA宏?
- magento -- 在magento中如何调用static block?
- Magento在代码中调用静态块
- 在magento中如何调用static block
- 在magento中如何调用static block?
- magento布局文件说明
- magento布局文件详解
- 在MainActivity中调用另外一个布局控件的方法
- 完整版的Android中在Sdcard文件新建文件夹,并在该文件夹中创文件并输入内容
- Android 中新建并配置一个Builder
- 查找程序所在上一级目录中是否存在指定文件夹,不存在就建立,并在其中新建一个txt文件
- 在一个HorizontalLayout中新建一个VerticalLayout
- android如何在一个布局文件中包含另外一个布局文件(include属性)
- 定时任务解决方案4 spring quartz 分布式解决 利用数据库保存任务
- SQL发送邮件
- Android 三 activity
- ASP.Net中设置web.config文件上传大文件方法
- Android 四 intent
- 在magento中新建并调用一个布局文件
- MFC— 无法添加按钮函数“cannot add new member” 和_CrtIsValidHeapPointer
- oracle表分区详解--学习一下
- Gladinet license
- vb.net datagridview 使用方法
- 关于error C2664
- 如何搭建hadoop
- 【原创】android 中安装应用程序方法及代码
- 五大主流浏览器CSS3和HTML5兼容性比拼