下面介紹一下解決方法:
首先打開后臺(tái)管理目錄的co_export.php文件,在大概第183行的位置找到如下代碼:
else if($itemName == 'litpic')
{
$litpic = trim($ctag->GetInnerText());
}
在其下面插入以下代碼:
else if($itemName == 'keywords')
{
$keywords = trim($ctag->GetInnerText());
}
else if($itemName == 'body')
{
$body = trim($ctag->GetInnerText());
$description = cn_substr(html2text($body),150);
$description = str_replace(' ','',$description);
$description = addslashes($description);
}
然后再找到如下代碼
$mainSql = str_replace('@sortrank@', $sortrank, $mainSql);
在其下面插入下面這句:
$mainSql = str_replace('@description@', $description, $mainSql);
再找到如下代碼:
$rs = $dsql->ExecuteNoneQuery($mainSql);
在其下面插入如下代碼:
$tags = InsertTags($keywords, $aid);
修改完成后保存即可。
這樣就會(huì)在采集的時(shí)候,發(fā)現(xiàn)原網(wǎng)頁上有keywords,采集并導(dǎo)入數(shù)據(jù)后,就會(huì)自動(dòng)寫入TAG,如果本來沒有keywords,就留空。description的話不管原網(wǎng)頁有沒有,都按采集回來的正文自動(dòng)生成純文本,不用擔(dān)心夾雜亂碼或者原網(wǎng)頁亂七八糟的內(nèi)容的。
]]>