[前台调用]查询指定分类下的信息列表DYCMS
<?php
$sql="select id,title,addtime from article where sortid in (".getChildrenId("article",1).") and rec=0 order by paixu asc,addtime desc,id desc limit 0,10";
$result=$conn->query($sq...
<?php
$sql="select id,title,addtime from article where sortid in (".getChildrenId("article",1).") and rec=0 order by paixu asc,addtime desc,id desc limit 0,10";
$result=$conn->query($sql);
if($result->num_rows>0){
while($data=$result->fetch_assoc()){
?>
<li>
<a href="article/show.php?id=<?php echo $data["id"]?>" title="<?php echo $data["title"]?>" target="_blank"><?php echo utf_substr($data["title"],20)?></a>
<span><?php echo date('Y-m-d H:i:s',$data["addtime"])?></li>
<?php
}
}
?>
调取内容字段:
<?php echo utf_substr(strip_tags(htmlspecialchars_decode($data["content"])),100)?>
缩略图不存在,显示“暂无图片”:
$sql="select id,title,addtime from article where sortid in (".getChildrenId("article",1).") and rec=0 order by paixu asc,addtime desc,id desc limit 0,10";
$result=$conn->query($sql);
if($result->num_rows>0){
while($data=$result->fetch_assoc()){
?>
<li>
<a href="article/show.php?id=<?php echo $data["id"]?>" title="<?php echo $data["title"]?>" target="_blank"><?php echo utf_substr($data["title"],20)?></a>
<span><?php echo date('Y-m-d H:i:s',$data["addtime"])?></li>
<?php
}
}
?>
调取内容字段:
<?php echo utf_substr(strip_tags(htmlspecialchars_decode($data["content"])),100)?>
缩略图不存在,显示“暂无图片”:
<?php if($data["suoluetu"]<>''){echo $data["suoluetu"];}else{echo 'skin/images/nophoto.jpg';}?>
调取信息所属分类的分类信息:
<a href='article/list.php?sortid=<?php echo $data["sortid"];?>'>
<?php echo sortinfo("article",$data["sortid"],"mingcheng");?>
</a>
上一篇:没有了
下一篇:[插件]仿QQ商城幻灯代码
我要评论