模板层次结构在magento中的工作方式与子主题在wordpress中的工作方式相同吗 [英] Does template hierarchy work the same in magento as child themes do in wordpress

查看:70
本文介绍了模板层次结构在magento中的工作方式与子主题在wordpress中的工作方式相同吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是magento的新手,我对主题感到困惑.我买了一个主题并安装了它,现在我需要进行一些更改.

I am new to magento and i'm confused about themes. I bought a theme and got it installed and now i need to make some changes.

在wordpress中 ...(我习惯了)在这一点上我要做的是制作一个子主题(本质上是一个css文件,其中包含少量代码)...,并且该子主题的任何更改都将仅覆盖该区域中的父主题 ,而父主题将控制其他所有主题,优点是在更新主题时我不需要维护一个"hacks list"并复制我的所有修改.

In wordpress ... ( which i am used to) what i would do at this point is to make a child theme ( which is essentially one css file with a tiny bit of code in it ) .... and any changes in that child theme would override the parent theme in that area only while the parent theme would govern everything else, the advantage being that when it comes to updating the theme i dont need to maintain a "hacks list" and reimpliment all my modifications.

然而,尽管magento具有主题层次结构",但卖给我主题的人却没有提及这样的内容,而建议仅编辑主题本身.

However the people who sold me the theme make no mention of anything like this, and suggest simply editing the theme itself, despite the fact that magento has a "theme hierarchy"

所以任何人都可以向我解释一下,模板层次结构在magento中的工作原理与子主题在wordpress中的工作原理相同吗?如果没有,那么通过更新主题来保持网站更改主题的过程是什么?原始下载版本中的开发人员

So can anyone explain this to me, Does template hierarchy work the same in magento as child themes do in wordpress... and if not what is the procdeure for updating the theme vis a vis keeping the theme alterations made by the site developer from the original downloaded version

推荐答案

模板层次结构在magento中的作用与在wordpress中子主题的作用相同

否.

与保持网站开发人员从原始下载版本进行的主题更改相比,更新主题的过程是什么

Magento(从1.4.1.1版开始)从底部开始,在下面有一个主题文件夹

Starting from the bottom, Magento (post 1.4.1.1) has a theme folder at

app/design/frontend/base/default

这是Magento将查找任何特定模板文件的最终位置.只有知道为什么要在其中编辑/添加文件的人才应该在其中编辑或添加文件.甚至大多数都不应该.

This is the final place Magento will look for any particular template file. Only people who know why they'd want to edit/add files in there should edit or add files in there. And even most of them shouldn't.

下一步(这很令人困惑,因此请注意,如果感到困惑也不要感到难过),Magento具有默认主题的概念.这是您在

Next up (and this is confusing, so pay attention, and don't feel bad if you're confused), Magento has the concept of a default theme. This is a theme name you configure in

System -> Configuration -> Design -> Themes -> Default Theme

此默认文件夹是放置基本主题的位置.如果输入值theirtheme,Magento将在以下位置查找主题模板和布局文件

This default folder is where you can put your base theme. If you entered the value theirtheme, Magento would look for theme template and layout files in

app/design/frontend/default/theirtheme/template
app/design/frontend/default/theirtheme/layout

接下来,主题由

  • 布局XML文件
  • 模板
  • 翻译文件
  • 皮肤"文件(位于应用程序/设计层次结构之外)

其中每个在

System -> Configuration -> Design -> Themes

因此,假设您将 Templates 模板的配置值配置为mytheme,并且将 Default 设置为如上所述的theirtheme. Magento首先会在

So, let's say you configured the Templates config value with the value mytheme, and your Default was set, as above, to theirtheme. Magento would first look for phtml template files in

app/design/frontend/default/mytheme/template/path/to/file.phtml

如果没有找到,它将使用您配置的默认主题

If it didn't find one there, it would look to the default theme that you configured

app/design/frontend/default/theirtheme/template/path/to/file.phtml

最后,如果在任何地方都找不到一个,它将最后一次检查

Finally, if it didn't find one in either place, it check one last time in

app/design/frontend/base/default/template/path/to/file.phtml

因此,听起来您想要做的就是将下载的主题设置为默认主题,然后配置一个自定义文件夹,您可以在其中添加更改.

So, it sounds like what you want to do is make the theme you downloaded your default theme, and then configure a custom folders where you can add your changes.

app/design/frontend

是一个区域.一个区域大致对应于一个Web应用程序.前端区域是购物车,adminhtml区域是管理控制台.

is a area. An area roughly corresponds to a single web application. The frontend area is the shopping cart, the adminhtml area is the Admin Console.

app/design/frontend/default

Design Package 文件夹.设计包是主题的集合.这通常会引起混乱,因为默认包与默认主题无关,但是它们共享相同的默认名称.

is the Design Package folder. A design package is a collection of themes. This often causes confusion, since the default package has nothing to do with the default theme, but they share the same, um, default name.

最后,没有主题供应商告诉您的内容,Magento仍然是一个年轻的平台,而且还在不断变化,这些事情的最佳实践仍在不断整理中.通常,取决于您来决定利用Magento各种系统的最佳方法.

Finally, w/r/t what your theme vendor told you, Magento's still a young platform and it's in flux, and the best practices for these sorts of things are still sorting themselves out. It's often going to be up to you to decide the best way to take advantage of Magento's various systems.

这篇关于模板层次结构在magento中的工作方式与子主题在wordpress中的工作方式相同吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆