php - Joomla 面包屑显示 "Uncategorized"类别

标签 php joomla breadcrumbs

我有一个菜单链接到 Joomla 中的“单篇文章”。

因此,面包屑是:主页 > 服务

现在,我创建了一篇要放入服务页面的文章。例如“开发服务”页面。

所以,我转到“服务”页面并创建到该页面的链接,现在导航栏是:主页 > 服务 > 未分类 > 开发服务

如何只放首页 > 服务 > 开发服务

有什么技巧吗?

最佳答案

Joomla Forum 找到了一些适合您的解决方法, 但考虑到 How to override the component mvc from the Joomla! core 中所述.这实际上隐藏了面包屑中的类别,但仅当 $this->item->catid 为 0 时,才可以很容易地进行修改。

你想要的改变在:components/com_content/views/article/view.html.php

$category = JCategories::getInstance('Content')->get($this->item->catid);
while ($category && ($menu->query['option'] != 'com_content' || $menu->query['view'] == 'article' || $id != $category->id) && $category->id > 1)
{
    $path[] = array('title' => $category->title, 'link' => ContentHelperRoute::getCategoryRoute($category->id));
    $category = $category->getParent();
}

关于php - Joomla 面包屑显示 "Uncategorized"类别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11249917/

相关文章:

php - 斯卡拉项目 + PHP

html - 在 Google 搜索中显示最后一个 Schema.org 面包屑条目?

css - ASP.NET:站点地图路径 CSS

php - 面向对象的方式从表中选择记录并存储在多维数组中

http - php-fpm 每天停止多次

php - Facebook graph API,获取所有广告账户

php - Joomla 3 身份验证以访问 PHP 中的外部应用程序

content-management-system - 带有 Joomla 的 Intranet 网站?

css - 在此 Joomla 插件代码中添加 CSS

yii - 如何为 Yii 定制面包屑小部件的链接?