国产日韩欧美综合色视频在线|日本在线中文字幕四区|最新中文字幕在线|成人女人天堂午夜视频

設(shè)為首頁(yè)加入收藏業(yè)務(wù)一覽表公司歷程公司介紹聯(lián)系我們
當(dāng)前位置網(wǎng)站運(yùn)營(yíng) >> Joomla技巧 - 如何禁止未分類(lèi)文章被站內(nèi)搜索

Joomla技巧 - 如何禁止未分類(lèi)文章被站內(nèi)搜索

應(yīng)用Joomla這樣的CMS(內(nèi)容治理系統(tǒng))時(shí),一個(gè)常見(jiàn)的標(biāo)題就是如何禁止例如致謝辭頁(yè)面、注冊(cè)頁(yè)面或此類(lèi)獨(dú)立的未分類(lèi)頁(yè)面被站內(nèi)搜索。

要解決這個(gè)標(biāo)題,我們需要修正這個(gè)文件:

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

基于你的需求,我們有兩種可選的解決方法。

第一種方法,假如你將所有這些獨(dú)立的頁(yè)面都回進(jìn)“未分類(lèi)(uncategorised)”這個(gè)section,那么可以按照下面的方法往做:

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

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

將它注釋掉;全部代碼段會(huì)像下面這樣:

// 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 );

第二種方法,假如你盼看做的更具體些,例如使某些特定的文章頁(yè)面避開(kāi)站內(nèi)搜索,那么需要在content.php文件中83行四周參加這行代碼:

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

終極全部代碼段會(huì)像下面這樣:

$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;

現(xiàn)在,你可以將“{nosearch}”添加到某篇文章的參數(shù)設(shè)置里的“Meta Info - Keywords”中,這樣,即使該文章中包含站內(nèi)搜索的關(guān)鍵字,它也不會(huì)呈現(xiàn)在搜索成果列表里了。搞定。

譯者:Viiiix

[來(lái)源:原創(chuàng)] [作者:嵊州新時(shí)代建站] [日期:10-04-13] [閱讀:]