帝国CMS如何调用关键词相同的文章呢?
根据关键字相关的方式调用,代码如下
<?php if ($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."keyboard like '%".$c_key[$i]."%'"; } $r=$empire->fetch1("select * from {$dbtbpre}ecms_news where id<>".$navinfor['id']." and ".$repadd." order by newstime desc limit 1"); if($r[title]) { $mesql=$empire->query("select titleurl,title,newstime from {$dbtbpre}ecms_news where id<>".$navinfor['id']." and ".$repadd." order by newstime desc limit 10"); while($or=$empire->fetch($mesql)) { $newstime=date('Y-m-d',$or[newstime]); ?> <li><a rel="nofollow noopener noreferrer" href="<?=$or[titleurl]?>"><?=$or[title]?></a><span><?=$newstime?></span></li> <? } } else { $mesql2=$empire->query("select * from {$dbtbpre}ecms_news where id<>".$navinfor['id']." order by rand() desc limit 10"); while($r2=$empire->fetch($mesql2)) { $newstime=date('Y-m-d',$o2[newstime]); ?> <li><a rel="nofollow noopener noreferrer" href="<?=$r2[titleurl]?>"><?=$r2[title]?></a><span><?=$newstime?></span></li> <? } } } else { $mesql2=$empire->query("select titleurl,title,newstime from {$dbtbpre}ecms_news order by rand() desc limit 10"); while($r2=$empire->fetch($mesql2)) { $newstime=date('Y-m-d',$r2[newstime]); ?> <li><a rel="nofollow noopener noreferrer" href="<?=$r2[titleurl]?>"><?=$r2[title]?></a><span><?=$newstime?></span></li> <? } } ?>
注释:我们不填写关键字的时候,随机调用文章,如果我们添加了关键字,没有相关的文章,也是随机调用文章
以上就是帝国cms相关调用 根据关键字调用相关内容。我能在冬天的严酷环境中生存下来,可能我会在春天是最漂亮的。更多关于帝国cms相关调用 根据关键字调用相关内容请关注haodaima.com其它相关文章!