从 Joomla 3 url 中删除文章 ID
我正在尝试从 Joomla 3 URL 中删除文章 ID.我四处搜索,结果在
I am trying to remove article id from Joomla 3 URL. I searched around and the response is in
组件com_contentouter.php
componentscom_contentouter.php
将 0 更改为 1$advanced = $params->get('sef_advanced_link', 1);
在第 38 和 290 行
on lines 38 and 290
并注释掉
if (strpos($segments[0], ':') === false) {$vars['view'] = '文章';$vars['id'] = (int)$segments[0];返回 $vars;}
我认为它在 Joomla 2.5 中运行良好,因为所有评论都提到了这一点.
I consider it works fine in Joomla 2.5 as all comments mention this.
但它在我的 Joomla 3.3 网站上对我不起作用.
But it does not do the job for me on my Joomla 3.3 website.
如何在不为每篇文章创建菜单项的情况下实现这一目标?
How can I achieve this without creating menu items for each article?
推荐答案
您可以通过修改 com_content
行中的 com_content
行,而不是在文件系统中进行并修改 Joomla 核心>extensions 表如下所述:http://www.itoctopus.com/how-to-remove-the-article-id-from-joomlas-sef-urls(该 URL 中描述了两种方法,文件系统方法和数据库方法)
Instead of doing it in the filesystem and modify the Joomla core, you can do this by modifying the com_content
row in the extensions
table as described here: http://www.itoctopus.com/how-to-remove-the-article-id-from-joomlas-sef-urls (the 2 methods are described in that URL, the filesystem method and the database method)
请注意,这是在 Joomla 3.x 上测试过的,它应该可以工作.如果它对您不起作用,那么您很可能需要清除 Joomla 缓存.
Note that this is tested on Joomla 3.x and it should work. If it doesn't work for you then most likely you will need to clear your Joomla cache.
相关文章