[英]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
这个类别标签会将类别名称新增至连结
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.