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/
$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/
相关文章推荐
- DX2.0缩略图类class_image.php
- PHP读取XML
- php gbk转拼音
- DotNet中FTP操作
- php 计算3公里内 用户的距离
- php计算两个经纬度地点之间的距离
- PHP对象在内存中的分配
- Smarty之变量调节器
- php导入导出execl方法
- php数组相加 两个数组键名相同 后者不能覆盖前者
- YII 2 配置
- PHP 命名空间 解惑
- Yii2 Form表单样式修改
- 华为三层交换机STP配置
- PHP中如何使用session实现保存用户登录信息
- php json中文乱码问题
- 烂泥:ubuntu下配置msmtp+mutt发送邮件
- 烂泥:ubuntu下配置msmtp+mutt发送邮件
- PHP的语言结构和函数的区别
- php大力力:技术排错过程中,关键点总结和心情历程(2015-10-19)