精品国产免费观看久久久_久久天天躁狠狠躁夜夜爽_无码人妻少妇久久中文字幕_狠狠做深爱婷婷久久综合一区

學習筆記

精準傳達 ? 價值共享

洞悉互聯網前沿資訊,探尋網站營銷規律

查看其它板塊

織夢當前文檔內容自動關聯tag標簽做內鏈

作者:狐靈科技 | 2020-10-28 19:47 |點擊:

1、后臺-系統-核心設置-關鍵字替換,選擇【

2、后臺-系統-其他選項-關鍵詞替換次數,填【1】或者【0

1:表示文檔內容里有多個關鍵詞,只讓1個是內鏈

0:表示文檔內容里有多個關鍵詞,都是內鏈

根據自己的需要填

3、打開 /include/arc.archives.class.php 找到,大概在1187行至1241行,整個函數

function ReplaceKeyword($kw,&$body)
{
	...中間代碼省略
}

 

整個改成

function ReplaceKeyword($kw,&$body)
{
	global $cfg_replace_num;
	$search = "/(alt\s*=\s*|title\s*=\s*|src\s*=\s*)[\"|\'](.+?)[\"|\']/is";
	$body = preg_replace_callback($search, array('Archives', '_base64_encode'), $body);
	$addsql = '';
	if(isset($this->Fields['tags']) && !empty($this->Fields['aid']))
	{
		$this->dsql->SetQuery("SELECT tid FROM `dede_taglist` WHERE aid = '{$this->Fields['aid']}' ");
		$this->dsql->Execute();
		$ids = '';
		while($row = $this->dsql->GetArray())
		{
			$ids .= ( $ids=='' ? $row['tid'] : ','.$row['tid'] );
		}
		if($ids != '')
		{
			$addsql = " WHERE id IN($ids) ";
		}
		if($addsql=='') return $body;
	}
	$query = "SELECT * FROM `dede_tagindex` $addsql ORDER BY addtime DESC";
	$this->dsql->SetQuery($query);
	$this->dsql->Execute();
	$linkdatas = array();
	while($row = $this->dsql->GetArray())
	{
		$row['keyword'] = $row['tag'];
		$row['rpurl'] = $cfg_cmsurl."/tags.php?/".urlencode($row['tag'])."/";
		$linkdatas[] = $row;
	}
	if($linkdatas) {
		$word = $replacement = array();
		foreach($linkdatas as $v) {
			$word1[] = '/(?!(<a.*?))' . preg_quote($v['keyword'], '/') . '(?!.*<\/a>)/s';
			$word2[] = $v['keyword'];
			$replacement[] = '<a href="'.$v['rpurl'].'" target="_blank">'.$v['keyword'].'</a>';
		}
		if($cfg_replace_num) {
			$body = preg_replace($word1, $replacement, $body, $cfg_replace_num);
		} else {
			$body = str_replace($word2, $replacement, $body);
		}
	}
	$body = preg_replace_callback($search, array('Archives', '_base64_decode'), $body);
	return $body;
}
function _base64_encode($matches) {
	return $matches[1]."\"".base64_encode($matches[2])."\"";
}
function _base64_decode($matches) {
	return $matches[1]."\"".base64_decode($matches[2])."\"";
}

 

4、完成,動態的直接看效果,靜態的記得重新生成文檔看效果

 


如沒特殊注明,文章均為狐靈科技原創,轉載請注明?? "織夢當前文檔內容自動關聯tag標簽做內鏈
多一份免費策劃方案,總有益處。

請直接添加技術總監微信聯系咨詢

網站設計 品牌營銷

多一份參考,總有益處

聯系狐靈科技,免費獲得專屬《策劃方案》及報價

咨詢相關問題或預約面談,可以通過以下方式與我們聯系

業務熱線:15082661954 / 大客戶專線:15523356218