Joomla 1.7 与 Virtuemart 2.0 –如何更改主页和其他子页面的模板
我是 Joomla 1.7 和 Joomla 的新手。美德市场。到目前为止,我已经使用了很多 CMS,在 Joomla 中我需要执行非常常见的任务。我需要为主页、产品列表和产品详细信息等设置不同的布局。每个页面都是从 *joomla root/templates/my_own_template/* 文件夹中的 index.php 生成的。
还有一个问题。有 Virtuemart 2.0 或 Joomla 1.7 文档吗?因为我可以看到这些版本与大多数文档编写的旧版本确实不同。
预先感谢您的答复。
I am a newbie to Joomla 1.7 & Virtuemart. I have used many CMS so far and in Joomla I need to do very common task. I need to have different layout for homepage, for product list and product details and so on. Every single page is generated from index.php which is in *joomla root/templates/my_own_template/* folder.
And one more question. Is there any Virtuemart 2.0 or Joomla 1.7 documentation? Because what I could see is that the versions are really different from old ones for which most documentation are written.
Thank you in advance for answers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能还找不到太多文档,因为这通常是代码完成并测试后开发人员要做的最后一件事。
至于更改模板,您不一定需要更改模板以具有不同的布局。首先,VM 有几个不同的主题文件(主题是 VM 模板),用于渲染各个页面。您在管理员中已经控制了不同的布局。您还可以通过在页面中添加或删除各种模块来更改特定页面。您可以将模块与站点中的所有页面、选择的页面、排除的页面以及根本没有页面关联。高级模块管理器等组件使您可以更好地控制模块显示的位置和时间。正确编码的模板将具有可折叠的模块位置。因此,左栏中没有模块的页面将不会有左栏。
最后,Joomla 1.7 还允许使用模板样式。当您安装模板时,它会创建默认样式。您可以复制和编辑该样式,然后将其分配给各个菜单项,以实现从一个页面到另一个页面的截然不同的外观。 http://docs.joomla.org/Help16:Extensions_Template_Manager_Styles_Edit
You're probably not going to find much documentation yet since that is usually the last thing that a developer does once the code is out and tested.
As for changing templates, you don't necessarily need to change templates to have different layouts. First, VM has several different theme files (theme is a VM template) that render the various pages. There are already different layouts you control in the admin. You can also change a particular page by adding or removing the various modules from pages. You can associate a module with all pages in the site, a selection of pages, an exclusion of pages, and no pages at all. Components like Advanced Module Manager give you even more control over where and when a module displays. A properly coded template will have collapsible module positions. So a page with no modules in the left column will not have a left column.
Lastly, Joomla 1.7 also allows the use of template styles. When you install a template, it creates a default style. You can duplicate and edit that style, then assign it to various menu items to achieve very different looks from one page to another. http://docs.joomla.org/Help16:Extensions_Template_Manager_Styles_Edit
Brent 的答案很好 – 他是对的,页面的外观可以通过分配哪些模块、使用哪个 VM 布局以及将不同的 Joomla 模板/样式分配给不同的菜单项来确定。
像 VirtueMart 这样的复杂组件经常出现的一个问题是,将不同的模板(或模块)分配给不同的菜单项可能很尴尬。这可能会打乱你的菜单结构,有时虚拟机会决定使用不同的菜单项来显示某些内容,而不是你认为应该显示的内容。所以这会弄乱模块和模板/样式。这是菜单项驱动的分配系统的缺点之一。
AMM 适合将模块分配到独立于菜单项的不同页面 - 正如 MetaMod(具有明确的 VM 支持)。
对于将模板/样式分配给VM中的不同页面,我建议使用Chameleon。 Chameleon 具有表单控件,用于选择有关 VM 的许多不同因素(例如所有子页面类型、项目类别、购物车内容等),您可以使用这些因素中的任何一个来触发特定模板/样式。它还可以触发其他操作,例如向页面添加 CSS/JS、删除任意菜单项、切换主页等。
因此,最终,使用 Brent 的技术以及 Chameleon、MetaMod 和/或 AMM,您将拥有大量控制权关于虚拟机中各个页面的外观。
Brent's answer is good – he's right that the look of a page can be determined by which modules are assigned, which VM layout is used, and by assigning different Joomla Templates/Styles to different menu items.
One issue that arises a lot with complex components like VirtueMart is that it can be awkward to assign different templates (or modules) to different menu items. This can mess up your menu structure, and there are times when VM will decide on a different menu item to display something rather than what you thought it should. So that messes up the modules and templates/styles. This is part of the down-side of having a menu-item-driven assignment system.
AMM is good for assigning modules to different pages independent of menu item - as is MetaMod (which has explicit VM support).
For assigning templates/styles to different pages in VM I would suggest Chameleon. Chameleon has form controls for selecting lots of different factors about VM (e.g. all the sub-page types, category of the item, cart contents and more) and you can use any of those factors to trigger a certain template/style. It can also trigger other actions like adding CSS/JS to the page, removing arbitrary menu items, switching the home page, etc.
So ultimately, using Brent's techniques and with Chameleon, MetaMod and/or AMM, you have a huge amount of control about how individual pages in VM look.