magento主题开发

magento主题开发实践QUICK GUIDE TO BUILDING A THEME FROM SCRATCH

日期:2016-09-07 阅读:1213

dmandwp系统 - wordpress系统和DM系统区块建站>>

记得先关闭缓存。

------

在开发主题时,一般都是从basic里复制文件。

但有时,我们也可以自己从头做一个文件。

 
Sample skeleton template,文件代码如下。

位置在:app/design/frontend/design_package/theme_variation/template/page/xx.phtml

名字起一个。和主题相关即可。

----------

DEFAULT LAYOUT VERSUS LAYOUT UPDATES
There are two types of layouts—default and updates. A default layout (page.xml) is the layout that by default applies itself to almost every page in the store. All other layout files are Layout Updates that simply updates the default layout on a per-page basis.

layout有两种,一种是default layout,这个一般是page.xml

另一种是layout updates

 

Let’s take for example your skeleton template: In the default layout, you have it set to three columns, which means by default most all of the page in your store will have the three column page structure. But it is not the three column structure you need for your product page. For IT, you want a two-column structure that includes a right column. To accommodate this, you will leave the default layout alone and open catalog.xml in which you can place some layout commands that tells the application to load the two-column structure to your product page instead of the default three. This is called the process of updating a layout.


Example method of assigning skeleton template:

给catalog重新分配page模板:
<reference name=“root”>
<action method=“setTemplate”><template>page/2columns-right.phtml</template></action>
</reference>


Let’s take another example: Say by default that you want a newsletter sign-up box in your right column, but in customer account pages you want to exclude it. In this case, you would leave your default layout alone and open up customer.xml, into which you will place a command that unsets the newsletter content block, excluding the newsletter functionality from the page.

 

 

 

<<点击返回