Joomla克制未分类文章被站内搜索

[摘要]Joomla!是一套在海外相当知名的内容打点系统。Joomla!是利用PHP语言加上MySQL数据库所开拓的软件系统,可以在Linux、 Windows、MacOSX等各类差异的平台上执行。

  利用Joomla这样的CMS(内容打点系统)时,一个常见的问题就是如何克制譬喻叩谢辞页面、注册页面或此类独立的未分类页面被站内搜索。要办理这个问题,我们需要修改这个文件:

joomla根路径/plugins/search/content.php

  基于你的需求,我们有两种可选的办理方法。

Joomla禁止未分类文章被站内搜索

  第一种方法,假如你将所有这些独立的页面都归入“未分类(uncategorised)”这个section,那么可以凭据下面的要领去做:

在上面的content.php文件第56行四周找到如下代码:

$sUncategorised = $pluginParams->get( ''search_uncategorised'', 1 );

将它注释掉,整个代码段会像下面这样:

// load plugin params info
$plugin =& JPluginHelper::getPlugin(''search'', ''content'');
$pluginParams = new JParameter( $plugin->params );

$sContent = $pluginParams->get( ''search_content'', 1 );
// $sUncategorised = $pluginParams->get( ''search_uncategorised'', 1 );
$sArchived = $pluginParams->get( ''search_archived'', 1 );
$limit = $pluginParams->def( ''search_limit'', 50 );

  第二种方法,假如你但愿做的更详细些,譬喻使某些特定的文章页面避开站内搜索,那么需要在content.php文件中83行四周插手这行代码:

$wheres2[] = "LOWER(a.metakey) NOT LIKE ''{nosearch}''";

  最终整个代码段会像下面这样:

$wheres = array();
switch ($phrase) {
case ''exact'':
$text = $db->getEscaped($text);
$wheres2 = array();
$wheres2[] = "LOWER(a.title) LIKE ''%$text%''";
$wheres2[] = "LOWER(a.introtext) LIKE ''%$text%''";
$wheres2[] = "LOWER(a.`fulltext`) LIKE ''%$text%''";
$wheres2[] = "LOWER(a.metakey) LIKE ''%$text%''";
$wheres2[] = "LOWER(a.metadesc) LIKE ''%$text%''";
$wheres2[] = "LOWER(a.metakey) NOT LIKE ''%{nosearch}%''";
$where = ''('' . implode( '') OR ('', $wheres2 ) . '')'';
break;

  此刻,你可以将“{nosearch}”添加到某篇文章的参数配置里的“Meta Info - Keywords”中,这样,纵然该文章中包括站内搜索的要害字,它也不会呈此刻搜索功效列内外了。

Joomla(囧啦) v1.6.5 中文版下载

Joomla禁止未分类文章被站内搜索

界面预览

分享到

Joomla禁止未分类文章被站内搜索

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/10614.html