thinkphp栏目管理
后台代码:
$this->mokuai('mokuai',类别的数字号码);
if(isset($_GET['lawid'])){
$this->mokuaixi('mokuai',$_GET['lawid']);
}
//自己封装的方法
function mokuai($chart='',$pid=''){
$user=D($chart);
$list=$user->where("products_category=".$pid."")->select();
//thumbRemoveOrigin
$this->assign("mokuai",$list);
}
function mokuaixi($chart='',$pid=''){
$user=D($chart);
$list=$user->where("products_id=".$pid."")->select();
//thumbRemoveOrigin
$this->assign("mokuaixi",$list);
}
前台显示
导航栏:
<volist name="mokuai" id="vo">
<li class="white"><a href="__URL__/serviced?lawid={$vo.products_id}">{$vo.products_name}</a></li>
</volist>
与导航栏对应的内容
<volist name="mokuaixi" id="vo">
<div id="right_top">
<div id="biaoti_rg"><h3>{$vo.products_name}</h3><span>发布时间:{$vo.products_uptime}</span></div>
<p style="text-indent:24px;"> {$vo.products_content}
</p>
</div>
</volist>