帝国cms内容页相关内容根据关键字来调用获取
网站文章内容页的相关文章,相关推荐是必不可少的,这些内容可以增加我们网页内容的相关性以及良好的内链结构,是对做SEO优化是很有帮助的。在使用帝国cms模板建网站的时候,内容页需要调用当前文章的其他相关的文章,根据关键……
网站文章内容页的相关文章,相关推荐是必不可少的,这些内容可以增加我们网页内容的相关性以及良好的内链结构,是对做SEO优化是很有帮助的。
在使用帝国cms模板建网站的时候,内容页需要调用当前文章的其他相关的文章,根据关键字调用,这样就实现相关性了。
代码示例如下:
<?phpif($navinfor['keyboard']){$c_key=explode(',',$navinfor['keyboard']);$count=count($c_key);for($i=0;$i<$count;$i++){if($i==0){$or='';}else{$or='or';}$repadd.=$or."keyboardlike'%".$c_key[$i]."%'";}$r=$empire->fetch1("select*from{$dbtbpre}ecms_newswhereid<>".$navinfor['id']."and".$repadd."orderbynewstimedesclimit1");if($r[title]){$mesql=$empire->query("selecttitleurl,title,newstimefrom{$dbtbpre}ecms_newswhereid<>".$navinfor['id']."and".$repadd."orderbynewstimedesclimit10");while($or=$empire->fetch($mesql)){$newstime=date('Y-m-d',$or[newstime]);?><li><ahref="<?=$or[titleurl]?>"><?=$or[title]?></a><span><?=$newstime?></span></li><?}}else{$mesql2=$empire->query("select*from{$dbtbpre}ecms_newswhereid<>".$navinfor['id']."orderbyrand()desclimit10");while($r2=$empire->fetch($mesql2)){$newstime=date('Y-m-d',$o2[newstime]);?><li><ahref="<?=$r2[titleurl]?>"><?=$r2[title]?></a><span><?=$newstime?></span></li><?}}}else{$mesql2=$empire->query("selecttitleurl,title,newstimefrom{$dbtbpre}ecms_newsorderbyrand()desclimit10");while($r2=$empire->fetch($mesql2)){$newstime=date('Y-m-d',$r2[newstime]);?><li><ahref="<?=$r2[titleurl]?>"><?=$r2[title]?></a><span><?=$newstime?></span></li><?}}?>
没有填写关键字,就随机调用文章,添加了关键字,没有相关的文章,也随机调用文章。
- 上一篇
帝国cms列表页的内容简介samlltext字段怎么格式化html代码
帝国CMS列表页内容简介smalltextsamlltext字段怎么格式化html代码呢?如下:$smalltext='esub(strip_tags($r[smalltext]),120)';$listtemp='<li><ahref="[!--titleurl--]"target="_blank">[!--tit
- 下一篇
解决帝国cms官方结合项插件静态页classid为空导致无法找到页面问题
1.global$public_r;改成global$public_r,$navclassid;2.if($_GET['classid']){$classid=RepPostVar($_GET['classid']);$urlcs.='&classid='.$classid;}改成if($_GET['classid']){$c