-
環保設備研發制造類網站...
-
灶具電器設備類網站織夢...
-
園林綠化景觀建設類網站...
-
車輛機油工業潤滑油類網...
-
攝影拍攝短視頻類網站織...
-
汽車配件類網站織夢模板...
-
APP應用程序官網類網站織...
-
道路護欄交通設施類網站...
-
企業公司行業通用類網站...
-
水上樂園設備類網站織夢...
-
水性工業漆類企業網站織...
-
網站建設營銷類網站織夢...
-
中藥藥材百科資訊類網站...
-
園林景觀設計類網站織夢...
-
辦公學習教程資訊類網站...
-
潮流資訊信息類網站織夢...
-
農業機械設備類網站織夢...
-
新媒體自媒體運營資訊類...
-
環保電動掃地車類網站織...
-
LED顯示屏中英雙外貿類網...
- 內鏈錨文本效果

- 實現教程
執行成功后,刷新后臺,查看系統基本參數-其它選項,最下面INSERT INTO `dede_sysconfig` (`aid`, `varname`, `info`, `groupid`, `type`, `value`) VALUES ('745', 'cfg_replace_links', '文檔內鏈允許最大鏈接數', '7', 'number', '10'), ('746', 'cfg_replace_key', '是否用關鍵詞做內鏈', '7', 'bool', 'Y'), ('747', 'cfg_replace_tag', '是否用TAG標簽做內鏈', '7', 'bool', 'Y');

2、打開/include/arc.archives.class.php文件
找到
改成if($arr['type']=='htmltext' && $GLOBALS['cfg_keyword_replace']=='Y' && !empty($this->Fields['keywords']))
再找到if($arr['type']=='htmltext' && $GLOBALS['cfg_keyword_replace']=='Y')
把整個函數改成function ReplaceKeyword($kw,&$body)
{
中間代碼略過...
}
繼續找到function GetTags()
{
global $cfg_cmsurl;
$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) ";
}
$query = "SELECT * FROM `dede_tagindex` $addsql ORDER BY addtime DESC";
$this->dsql->SetQuery($query);
$this->dsql->Execute();
$result = array();
while ($row = $this->dsql->GetArray())
{
$result[trim($row['tag'])] = $cfg_cmsurl . "/tags.php?/" . urlencode($row['tag']) . "/";
}
return $result;
}
function GetKeyWord()
{
$query = "SELECT * FROM `dede_keywords` WHERE `rpurl` <> '' ORDER BY `rank` DESC ";
$this->dsql->SetQuery($query);
$this->dsql->Execute();
$result = array();
while ($row = $this->dsql->GetArray())
{
$result[trim($row['keyword'])] = trim($row['rpurl']);
}
return $result;
}
function ReplaceRes($text, $key, $url)
{
global $cfg_replace_num;
$tmp = $text;
$tags = $a = array();
if (preg_match_all("#<a[^>]+>[^<]*</a[^>]*>#su", $tmp, $m))
{
$a = $m[0];
foreach ($m[0] as $k => $z)
{
$z = preg_replace("#\##s", "\#", $z);
$tmp = preg_replace('#' . $z . '#s', "[_a" . $k . "_]", $tmp, 1);
}
};
if (preg_match_all("#<[^>]+>#s", $tmp, $m))
{
$tags = $m[0];
foreach ($m[0] as $k => $z)
{
$z = preg_replace("#\##s", "\#", $z);
$tmp = preg_replace('#' . $z . '#s', "[_tag" . $k . "_]", $tmp, 1);
}
}
$key1 = preg_replace("#([\#\(\)\[\]\*])#s", "\\\\$1", $key);
$tmp = preg_replace("#(?!\[_s|\[_a|\[_|\[_t|\[_ta|\[_tag)" . $key1 . "(?!ag\d+_\]|g\d+_\]|\d+_\]|s\d+_\]|_\])#us", '<a href="' . $url . '" target="_blank"><u>' . $key . '</u></a>', $tmp, $cfg_replace_num);
if (!empty($a))
{
foreach ($a as $n => $at)
{
$tmp = str_replace("[_a" . $n . "_]", $at, $tmp);
}
}
if (!empty($tags))
{
foreach ($tags as $n => $at)
{
$tmp = str_replace("[_tag" . $n . "_]", $at, $tmp);
}
}
return $tmp;
}
function ReplaceKeyword($kw, &$body)
{
global $cfg_replace_links, $cfg_replace_key, $cfg_replace_tag;
$cfg_replace_links = isset($cfg_replace_links) ? $cfg_replace_links : 10; // 文檔內鏈允許最大鏈接數
$cfg_replace_key = isset($cfg_replace_key) ? $cfg_replace_key : 'Y'; // 關鍵詞內鏈(默認開啟)
$cfg_replace_tag = isset($cfg_replace_tag) ? $cfg_replace_tag : 'N'; // TAG內鏈(默認不開啟)
if ($cfg_replace_key == 'Y' && $cfg_replace_tag == 'N')
{
$arrkey = $this->GetKeyWord();
}
elseif ($cfg_replace_key == 'N' && $cfg_replace_tag == 'Y')
{
$arrkey = $this->GetTags();
}
elseif ($cfg_replace_key == 'Y' && $cfg_replace_tag == 'Y')
{
$arrkey = $this->GetKeyWord() + $this->GetTags();
}
$keys = array();
foreach ($arrkey as $k => $url)
{
$k = trim($k);
if (!$k)
{
continue;
}
if (strpos($body, $k) !== false)
{
$keys[$k] = $url;
}
}
$keys_tmp = array_keys($keys);
usort($keys_tmp, "cmp");
foreach ($keys_tmp as $i => $key)
{
$ki = $i + 2;
if ($ki > $cfg_replace_links)
{
break;
}
if (is_array($keys[$key]))
{
$url = $keys[$key][rand(0, count($keys[$key]) - 1)];
}
else
{
$url = $keys[$key];
}
$body = $this->ReplaceRes($body, $key, $url);
}
return $body;
}
在它的上面加入function _highlight
function cmp($a, $b)
{
if (mb_strlen($a) == mb_strlen($b))
{
return 0;
}
return (mb_strlen($a) < mb_strlen($b)) ? 1 : -1;
}





