简体   繁体   English

Joomla。 如何在default.php中编辑菜单的链接?

[英]Joomla. How to edit the link of the Menu in default.php?

I want to edit Menu in Joomla. 我想在Joomla中编辑菜单。

Me need to replace 我需要更换

<li class="item-101 default"><a href="/2/index.php">Светлое</a></li>

on

<li class="item-101 default"><a href="/2/index.php"><span class="MyClass">Светлое</span></a></li>

I think this is done in this file nameTemplate\\modules\\mod_menu\\tmpl\\default.php 我认为这是通过以下文件nameTemplate\\modules\\mod_menu\\tmpl\\default.php完成的: nameTemplate\\modules\\mod_menu\\tmpl\\default.php

or nameTemplate\\modules\\mod_menu\\tmpl\\default_url.php nameTemplate\\modules\\mod_menu\\tmpl\\default_url.php

But I can not solve the problem. 但是我不能解决问题。 Can anyone help? 有人可以帮忙吗?

Thanks 谢谢

You can add a class label under the option tab of this menu entry. 您可以在此菜单项的选项标签下添加类标签。 This class label will add the class Name to the link 这个类别标签会将类别名称新增至连结

  • Copy modules/mod_menu/tmpl/default.php 复制模块/mod_menu/tmpl/default.php
  • ...to /templates/nameTemplate/html/mod_menu/default.php ...到/templates/nameTemplate/html/mod_menu/default.php

This will override the default menu template file. 这将覆盖默认菜单模板文件。 In the copied file, add the following inside the foreach-loo around line 22 ( <?php foreach ($list as $i => &$item) ): 在复制的文件中,在第22行( <?php foreach ($list as $i => &$item) )的foreach-loo中添加以下内容:

if($item->id == 101) {
  $item->title = "<span class=\"MyClass\">{$item->title}</span>";
}

This should add a span with your own class on menu item 101. 这应该在菜单项101上添加您自己的班级的跨度。

(Still, Lovntola's answer should solve your problem in an easier way) (不过,Lovntola的答案应该可以更轻松地解决您的问题)

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

相关问题 如何在Joomla 3 default.php文件中更改菜单类以模仿自定义菜单类 - How to change the menu classes in Joomla 3 default.php file to mimic custom menu classes 如何通过Ajax将default.php中的值传递给view.html.php-joomla3.x - How to pass a value from default.php to view.html.php through ajax - joomla3.x joomla 2.5模块:如何将foreach循环放入tmpl / default.php - joomla 2.5 module: how to foreach loop put in tmpl/default.php 在joomla组件中的default.php内部查看路径 - View path inside default.php in joomla component Joomla 2.5在default.php中加载javaScript文件 - Joomla 2.5 Loading javaScript Files inside default.php 从default.php隐藏的传递变量不起作用-joomla 3 - passing variable as hidden from default.php is not working - joomla 3 在Virtuemar选项卡/ default.php / Joomla 3.7.5中插入Chronoforms - Insert Chronoforms in Virtuemar tabs / default.php / Joomla 3.7.5 如何将$ _GET [&#39;&#39;]值从mod_modulenamet / mpl / default.php中的$ document-&gt; addStylesheet()转换为joomla模块的css.php文件 - How to $_GET [' '] value from $document->addStylesheet() in mod_modulenamet/mpl/default.php to css.php file of joomla module 我的Concrete5页面类型将仅使用Default.php - My Concrete5 Page Types Will Only Use Default.php 禁用Ruby on Rails,正确索引到default.php - Disable Ruby on Rails, correctly index to default.php
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM