帝国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
暂无评论内容