Based on Discuz online segmentation batch optimization dedecms Article keywords

Source: Internet
Author: User
Keywords Discuz keyword optimization

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

Dedecms itself with tag (keywords) extraction function, but the participle is always not accurate. Of course, for the daily update a dozen and for SEO accurate implementation of users, manual input can better control. But for the topic is relatively broad, the content update quantity big user, Dede split is not perfect.

Discuz online participle is an online free teleprompter interface. There are hundreds of thousands of Chinese forum, supsite users, for the context, the improvement of the cell thesaurus has more data. This small program is based on Discuz online segmentation batch update has been sent content keywords (tag), if the data volume (greater than 50,000) or virtual host users, the best environment to take local. Faster.

Use method, CMS installation directory, new c.php, copy into the following content, their corresponding coding with Notepad set corresponding GBK or UTF8. Run yourwebsite/c.php?id=1

<?php
Require_once (DirName (__file__). /include/common.inc.php ");

$id = Isset ($id) && is_numeric ($id)? $id: 0;

for ($a = $id; $a < $id +10; $a + +) {

$row = $dsql->getone ("Select Arc.title,tp.body from ' @__archives ' arc left JOIN ' @__addonarticle ' TP on Arc.id=tp.aid where arc.id= ' $a ');
if (Is_array ($row))
{
$title = $row [' title '];
$body = $row [' body '];
$keywords =zhgetkey ($title. $body);
$dsql->executenonequery ("Update" @__archives ' Set keywords= ' $keywords ' where id= ' $a ');
echo $a. ': $keywords. ' <br/> ';
}
}

if ($a >80000) {break;}

echo "<script>";
echo "settimeout (\" Location.replace (' c.php?id= $a ') \ ", 0)";
echo "</script>";

function Zhgetkey ($contents) {
$rows = Strip_tags ($contents);
$arr = Array (",", "\s", "\ r \ n", "\ n", "\ r", "T", ">", "" "," "," <br/> ");
$QC _rows = Str_replace ($arr, ", $rows);
if (strlen ($QC _rows) >2400) {
$QC _rows = substr ($qc _rows, ' 0′, ' 2400′);
}
$data = @implode (", File (" http://keyword.discuz.com/related_kw.html?title= $qc _ROWS&ICS=GBK&OCS=GBK "));
Preg_match_all ("/<kw> (. *) a\[(. *) \]\] (. *) ><\/kw>/", $data, $out, Preg_set_order);
$key = "";
For ($i =0 $i <5; $i + +) {
$key = $key. $out [$i][2];
if ($out [$i][2]) $key = $key. ",";
}
return $key;
}

function cutstr_html ($string, $sublen)

{

$string = Strip_tags ($string);

$string = preg_replace ('/\n/is ', ", $string);

$string = Preg_replace ('/|/is ', ", $string);

$string = preg_replace ('/&nbsp;/is ', ", $string);

Preg_match_all ("/[\x01-\x7f]|[ \xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]| [\xe1-\xef] [\X80-\XBF] [\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]| [\xf1-\xf7] [\X80-\XBF] [\X80-\XBF] [\x80-\xbf]/, $string, $t _string);

if (count ($t _string[0]) –0 > $sublen) $string = Join (", Array_slice ($t _string[0], 0, $sublen))." ...”;

else $string = Join (", Array_slice ($t _string[0], 0, $sublen));

return $string;

}

?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.