帝国cms根据关键词调用文章

帝国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."title like '%".$c_key[$i]."%'";
}
$r=$empire->fetch1("select titleurl,title 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 from {$dbtbpre}ecms_news where id<>".$navinfor['id']." and ".$repadd." order by newstime desc limit 10");
while($or=$empire->fetch($mesql))
{
?>
<a href="<?=$or[titleurl]?>" target="_blank"><?=$or[title]?></a>
<?
}
}
else
{
  
$mesql2=$empire->query("select titleurl,title from {$dbtbpre}ecms_news where id<>".$navinfor['id']." order by rand() desc limit 10");
while($r2=$empire->fetch($mesql2))
{
?>
<a href="<?=$r2[titleurl]?>" target="_blank"><?=$r2[title]?></a>
<?
}
}
}
?>

© 版权声明
THE END
喜欢就支持一下吧
点赞15
相关推荐
评论 抢沙发

请登录后发表评论

    暂无评论内容