ThinkPHP3.2 volist嵌套循环显示原理

php页面:
$fatherList = $Document->where('pid=1')->select();
        foreach($fatherList as $n=> $val)
        {
            $fatherList[$n]['childList']=D('Document')->where('category_id=\''.$val['id'].'\'')->select();
                //$Baojia->where('belongto=\''.$val['name'].'\'')->select();
        }
        $this->assign('fatherList',$fatherList);


html页面:
<volist name="fatherList" id='data'>
       <dl>
                 <dt class="active">{$data.title}</dt>
                 <dd style="display:block;">
                      <volist name="data['childList']" id="vo">
                            <a class="active" title="简介" href="http://youlanzihun.blog.163.com/">·{$vo.title}</a>
                     </volist>
                </dd>
      </dl>

</volist>
 转自:http://youlanzihun.blog.163.com/blog/static/3731171020142214112126/
posted @ 2015-10-20 10:42  绿尘枫  阅读(2017)  评论(0编辑  收藏  举报