ThinkPHP3.2 volist嵌套循环显示原理
生活随笔
收集整理的這篇文章主要介紹了
ThinkPHP3.2 volist嵌套循环显示原理
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
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> 轉(zhuǎn)自: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> 轉(zhuǎn)自:http://youlanzihun.blog.163.com/blog/static/3731171020142214112126/
轉(zhuǎn)載于:https://www.cnblogs.com/lvchenfeng/p/4894124.html
總結(jié)
以上是生活随笔為你收集整理的ThinkPHP3.2 volist嵌套循环显示原理的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python 面向对象(进阶篇)
- 下一篇: (算法)Word Break