【问题标题】:joomla 2.5 navigation menu subtitle [closed]joomla 2.5 导航菜单副标题 [关闭]
【发布时间】:2012-11-17 11:18:18
【问题描述】:

您好,我是网页设计师,我想知道如何设置菜单字幕?使用 yoo 主题很容易实现,但我需要知道不使用 YooTheme 模板是如何完成的。我认为 mod_menu 需要进行少量修改,但我不知道具体是什么。 google了一天也没找到解决办法。

【问题讨论】:

  • 字幕是什么意思?在哪里?
  • 也许附上一张我们理解您的意思的图片。
  • 像这个模板这样的字幕有demo.rockettheme.com/?template=kirigami,由于搜索引擎优化和文件调用次数的增加,没有图像是个坏主意
  • 你的意思是 Welcome!HomeAwesome StuffFeatures 等下。 .. ?

标签: php joomla menu navigation joomla2.5


【解决方案1】:

当然有更好的解决方案,但我是这样做的:

在菜单项的名称中插入一个字符。例如“|”。 它应该如下所示: 标题 |字幕。在这个位置你可以划分名字。

现在你必须override modules/mod_menu/tmpl 中的文件 default_component.php。

添加以下行:

$parts = explode("|", $linktype);
// the "|" is the divider
if(isset($parts[1])){
    $linktype = $parts[0].'<span>'.$parts[1].'</span>';
}else{
    $linktype = $parts[0];
};

之后:

$class = $item->anchor_css ? 'class="'.$item->anchor_css.'" ' : '';
$title = $item->anchor_title ? 'title="'.$item->anchor_title.'" ' : '';
if ($item->menu_image) {
        $item->params->get('menu_text', 1 ) ?
        $linktype = '<img src="'.$item->menu_image.'" alt="'.$item->title.'" /><span class="image-title">'.$item->title.'</span> ' :
        $linktype = '<img src="'.$item->menu_image.'" alt="'.$item->title.'" />';
}
else { $linktype = $item->title;
}

现在您在字幕周围有了一个跨度,并且可以对其进行样式设置。

【讨论】:

    猜你喜欢
    • 2013-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-11
    • 1970-01-01
    • 2013-03-15
    • 1970-01-01
    • 2020-05-17
    相关资源
    最近更新 更多