简体   繁体   English

Joomla 1.7中菜单项的样式(模板)分配-困惑

[英]Style (template) assignment to menu items in Joomla 1.7 - baffled

I have a number of Template Styles. 我有许多模板样式。 If I change the default Style, I can see that my Styles are working. 如果更改默认样式,则可以看到我的样式正在运行。 The Style actually changes. 样式实际上会更改。 But for a week I have been trying to find out why my menu assignment doesn't work. 但是一个星期以来,我一直试图找出为什么我的菜单分配不起作用。 I'm completely baffled. 我完全困惑。

So I have found two possible places where I could possibly change my Style per menu item. 因此,我发现了两个可能可以更改每个菜单项样式的地方。 Either in Template Manager: Edit Style -> Menus assignment -> ticking the menu item. 在模板管理器中:编辑样式->菜单分配->选中菜单项。 Or Menu Manager: Edit Menu Item -> Changing Template Style. 或菜单管理器:编辑菜单项->更改模板样式。 I have tried these settings a hundred times. 我已经尝试了这些设置一百次。 Those settings have absolutely no effect. 这些设置完全无效。

Where can I change the Style so that I get different Style for each menu item (by menu item I mean the page opened by the menu item)? 在哪里可以更改样式,以便为每个菜单项获得不同的样式(所谓菜单项,是指菜单项打开的页面)?

尝试创建单独的样式文件(如mymenu1style.php,mymenu2style.php等)以及相应的XML文件,如该文档的“菜单”部分中的http://docs.joomla.org/Layout_Overrides_in_Joomla_1.6中所述,然后在其中分配每个样式菜单管理器“编辑菜单项->更改模板样式”

I found the answer. 我找到了答案。 I didn't use the actual Joomla menus before so I didn't know what links they produce. 我之前没有使用过实际的Joomla菜单,所以我不知道它们产生了什么链接。 And there was a trick in the links they produce. 他们产生的联系中有一个窍门。 On Menu Manage: Edit Menu Item there is the Link for the menu item ready for copypaste. 在菜单管理:编辑菜单项上,有准备复制粘贴的菜单项的链接。 However, this link is for example: 但是,此链接例如:

index.php?option=com_content&view=article&id=65

and the Itemid variable is missing from that! 并且缺少Itemid变量! If it's missing, the template style will be the default one instead of the assigned one! 如果丢失,则模板样式将是默认样式,而不是已分配的样式! So the correct link is, for example: 因此,正确的链接是例如:

index.php?option=com_content&view=article&id=65&Itemid=205 (note exact cases on Itemid) (the Itemid, aka ID, is in fact also on the same Edit Menu Item page, but just separately) index.php?option=com_content&view=article&id=65&Itemid=205 (请注意Itemid的确切情况)(Itemid,也就是ID,实际上也位于同一“编辑菜单项”页面上,但只是分开)

Or the other correct link is, after enabling Global Configuration / Site / SEO Settings / SEF URLs Yes: 或另一个正确的链接是,在启用全局配置/站点/ SEO设置/ SEF URL之后,是:

http://site.com/index.php/menualias http://site.com/index.php/menualias

That would also render with the assigned template. 这也将与分配的模板一起呈现。 Or without the index.php/ part with the URL rewriting option. 或没有带有URL重写选项的index.php /部分。

So, which overrides which: the Edit Menu Item / Template Style setting or the Template Manager: Edit Style Menus assignments? 因此,哪个优先于哪个:“编辑菜单项/模板样式”设置或“模板管理器:编辑样式菜单”分配? The answer is, according to my test, if you keep the EMI Template Style as - Use Default - , then you can change it from Menus assignments. 答案是,根据我的测试,如果将EMI模板样式保留为-使用默认值- ,则可以从菜单分配中更改它。 In other cases, the last saved situation overrides. 在其他情况下,最后保存的情况将被覆盖。 If you have EMI Template Style set to mystyle1 and Menus assignments the same page is set to mystyle2 , the latter will override while the EMI Template Style remains set to mystyle1 . 如果你有EMI模板样式为mystyle1和菜单分配在同一个页面被设置成mystyle2,而EMI模板样式保持设置mystyle1后者将覆盖。 So it's a bit confusing. 因此有点混乱。 Then if for the page you change EMI Template Style to mystyle3 , that will blank out the Menus assignments setting and therefore override that. 然后,如果将页面的EMI模板样式更改为mystyle3 ,这将使菜单分配设置空白,因此将其覆盖。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM