MENU service case
 Website construction website design Beijing website construction high-end website production company Shangpin China
We create by embracing change
360 ° brand value__
simplified Chinese character
Simplified Chinese English

Shangpin China Joins Hands with Beisheng Internet to Create a New Chapter in Website Construction

Type: Shangpin Dynamic Learn more

Batch Optimization of Dedecms Article Keywords Based on Discuz Online Word Segmentation

Source: Shangpin China | Type: website encyclopedia | Time: December 22, 2011

Batch Optimization of Dedecms Article Keywords Based on Discuz Online Word Segmentation

Dedecms has its own tag (keywords) extraction function( Beijing website production ), but the participle is always not accurate enough. Of course, for users who update more than ten articles a day and implement SEO accurately, manual input can be better controlled( High end website construction )。 However, dede split is not perfect for users with broad themes and large amount of content updates.

Discuz online word segmentation is an online free prompt interface. After that, there are hundreds of thousands of Chinese forums and upsite users, who have more data on the improvement of context and cell thesaurus. This small program is based on the discuz online word segmentation to batch update the keywords (tags) of the sent content. If the data volume is large (more than 50000) or the virtual host users, the best environment is local. The speed will be faster.

To use it, create a cms installation directory, create a new c.php, copy the following content, and use notepad to set the corresponding gbk or utf8 for the corresponding code. Run your website/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”, “rn”, “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(“ //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;

 }

?>

Source Statement: This article is original or edited by Shangpin China's editors. If it needs to be reproduced, please indicate that it is from Shangpin China. The above contents (including pictures and words) are from the Internet. If there is any infringement, please contact us in time (010-60259772).
TAG label:

What if your website can increase the number of conversions and improve customer satisfaction?

Make an appointment with a professional consultant to communicate!

* Shangpin professional consultant will contact you as soon as possible

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]

Communicate with professional consultants now!

  • National Service Hotline

    400-700-4979

  • Beijing Service Hotline

    010-60259772

Please be assured to fill in the information protection
Online consultation

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]