织梦系统中文章自动插入关键字和相关链接,这样可以提高网站关系度与seo优化,提高网站排名,代码如下:
- //关键字和相关文章插入开始
- $open_mytag=1;//1为开启,0为关闭
- if($open_mytag){
- if($keywords){
- $mykeyword = explode(',',$keywords);
- $body = SpLongBody($body,700,$mykeyword[0]);//每隔200字节插入关键字1(200可改)
- $body = count($mykeyword)>1?SpLongBody($body,1200,$mykeyword[1]):$body;//插入关键字2
- }//关键字插入
- if($tags){
- $mytag = explode(',',$tags);
- $aa=rand(0,count($mytag)-1);
- $stag=$mytag[$aa];
- $mylink = $dsql->GetOne("Select aid From `#@__taglist` where tag='$stag' order by rand()");
- $myid = $mylink['aid'];
- $mytitle = $dsql->GetOne("Select title From `#@__archives` where id='$myid'"); //Vevb.com
- $myurl = MakeArt($myid,true,true,$isremote);
- $myst = $mytitle['title'];
- $mys = '<a href="'.$myurl.'">'.$myst.'</a>';
- $mynum = ceil(strlen($body)/2);
- $body = SpLongBody($body,$mynum,$mys);//插入相关链接
- }//相关文章插入
- }
- //关键字和相关文章插入结束
新闻热点
疑难解答