PHP博客 联系 聚合 管理  

Blog Stats

随笔档案

文章档案


nuoyan

smarty前台开发终端页面

view.htm
//------------------------
这里是导航引入 和配置引入
-----------------------//
//查询新闻内容和基本信息 复合查询
if(!empty($_GET[id])){
    $query=$db->findall("p_newsbase as a,p_newscontent as b where a.id=b.nid and a.id='$_GET[id]'");
    $row_news=$db->fetch_array($query);//带id 带键值
          $row_news[date_time]=date("Y-m-d H:i",$row_news[date_time]);
}
//相关新闻
$query=$db->findall("p_newsbase where cid=$row_news[cid] order by id desc limit 5");
   while($row=$db->fetch_array($query)){
              
          $sm_aboutnews[]=array('id'=>$row[id],'title'=>$row[title]);  
}

$smarty->assign('row_news',$row_news);
$smarty->assign('sm_aboutnews',$sm_aboutnews);
$smarty->display('view.htm');


{include file="head.htm"}
<!-------新闻内容//-------->
<div>
<h2>{$row_news[title]} </h2><br>
时间:{$row_news[date_time]}  作者:{$row_news[author]} <br>
<br><br><br>
{$row_news[content]}
</div>
{section name=l loop=$sm_aboutnews}
<h5>相关新闻:<a href="view.php?id={$sm_aboutnews[l].id}"><font color=red>{$sm_aboutnews[l].title}</font></a></h5>
{/section}
{include file="footer"}

posted on 2010-01-13 10:16 nuoyan 阅读(162) 评论(0)  编辑 收藏 引用 网摘

只有注册用户登录后才能发表评论。
网站导航: