Home > Backend Development > PHP Tutorial > thinkphp template assignment problem

thinkphp template assignment problem

WBOY
Release: 2016-10-17 09:30:23
Original
1103 people have browsed it

<code class="php">$User = M('User');
$list = $User->limit(10)->select();
$this->assign('list',$list);

<volist name="list" id="vo">
{$vo.select}<br/>
</volist>
</code>
Copy after login
Copy after login

If my {$vo.select} is still an array at this time, how can I traverse this array in the template?

Reply content:

<code class="php">$User = M('User');
$list = $User->limit(10)->select();
$this->assign('list',$list);

<volist name="list" id="vo">
{$vo.select}<br/>
</volist>
</code>
Copy after login
Copy after login

If my {$vo.select} is still an array at this time, how can I traverse this array in the template?

Nest another volist

<code><volist name="vo.select" id="selecter">
    {{ selecter.name }}
</volist></code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template