根据分类  展示不同页面:

案例一:

 

 

案例二: 

 

 

同宽度展示不同页面:

 if ($child_cate_id) {
            $hangye_pid = M("hangye")->where("status=1 and cate_id='{$data}' and lang='{$this->lang}'")->select();
        } else {
            $hangye_pid = M("hangye")->where("status=1 and cate_id='{$cate_id}' and lang='{$this->lang}'")->select();
        }
        $this->assign('hangye_pid', $hangye_pid);
        $num = count($hangye_pid);
        $this->assign('widthPercent', 100/$num);
}

 

<li class="hangye-li <if condition=' $key eq 0 '>active </if> "  style="width: {$widthPercent}%;"  name="hangye-li-{$val.id}" >