后盾网的一个视频教程,谁帮看一下是什么原因[已解决]?

浏览:641 发布日期:2016/04/29 分类:求助交流
问题:现在p($cids)可以打印出来了,就是第二层没办法在模板中循环出来?
1、IndexAction.class.phppublic function index () {
$topCate=M('cate')->where(array('pid'=>0))->order('sort')->select();
import('Class.Category',APP_PATH);
$cate=M('cate')->order('sort')->select();
$db=M('blog');
$field=array('id','title','time');
foreach ($topCate as $k=>$v){
$cids=Category::getChildsId($cate, $v['id']);
$cids[]=$v['id'];
$where=array('cid'=>array('IN',$cids));
$topCate[$k]['blog']=$db->field($field)->where($where)->select();
}
$this->cate=$topCate;
$this->display();
}
}
2、index.html    <div class='main'>
        <div class='main-left'>
            <p>后盾博文</p>
<foreach name="cate" item="v">
<dl>
<dt>{$v.name}<a href="{:U('/c_'.$v['id'])}">更多>></a></dt>
<foreach name="v.blog" item="value">
<dd>
<a href="{:U('/'.$value['id'])}">{$value.title}</a>
<span>{$value.time|date="m/d",###}</span>
</dd>
</foreach>
</dl>
</foreach>
</div>
最佳答案
评论( 相关
后面还有条评论,点击查看>>