Home > Backend Development > PHP Tutorial > thinkphp的模板中循环如何传递变量

thinkphp的模板中循环如何传递变量

WBOY
Release: 2016-06-13 12:03:07
Original
1121 people have browsed it

thinkphp的模板中循环怎么传递变量?
Thinkphp的内容模板页,内容页的id为 {$cont.id}  ,在内容页能直接输出,比如页面地址为/page-51, {$cont.id}可以直接输出51。

在内容页面有一个循环列表,需要把这个 {$cont.id} 传入,但是每次都获取不到。

写法一

<br /><wlist num="10"  conid="{$wcon.id}"  name="list_rank"><br />      <a href="{$list.url}" >xxx</a><br /></wlist><br />
Copy after login


写法二
<br /><wlist num="10"  conid="$wcon[id]"  name="list_rank"><br />      <a href="{$list.url}" >xxx</a><br /></wlist><br />
Copy after login


{$wcon.id}怎么才能让他的值传递到循环里面呢?
------解决方案--------------------
有 wlist 标签吗?
只有 volist 吧
------解决方案--------------------
自定义的不也要定义处理代码吗?
你怎么定义的,就怎么传。
别人怎么知道

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