您的位置:首页 > 编程语言 > PHP开发

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

2015-10-20 10:42 591 查看
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/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: