php的话.现在结合数据库.可以写成非递归的无限级了。请google..
解决方案 »
- 字符串转化为数字???
- 关于oAuth认证的参数的疑问
- $_POST[]问题
- php 正则问题
- 在Linux系统中,如何让PHP支持Socket?怎么配置使查看phpinfo()时:Sockets Support 即为enabled ?高人请进!!
- MYSQL有存储过程吗
- 会PHP的高人请进来.....
- 各位高手能否做个通用的组合查询?
- PHP 一直报错.而且还不能正常访问.这是什么情况PHP Warning: mysqli::mysqli()(HY000/2003)
- 菜鸟求一段PHP代码,先谢谢了!
- Use of undefined constant name - assumed 'name' in ……的错误,代码如下:
- smarty的缺点是什么?
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
*}
{* 键就是数组的下标,请参看关于数组的解释 *}{foreach name=outer item=contact from=$contacts}
{foreach key=key item=item from=$contact}
{$key}: {$item}<br>
{/foreach}
{/foreach}OUTPUT:phone: 1<br>
fax: 2<br>
cell: 3<br>
phone: 555-4444<br>
fax: 555-3333<br>
cell: 760-1234<br>
Example 7-16. section loop variable
例 7-16.loop 变量演示 {* the loop variable only determines the number of times to loop.
you can access any variable from the template within the section.
This example assumes that $custid, $name and $address are all
arrays containing the same number of values *}
{section name=customer loop=$custid}
id: {$custid[customer]}<br>
name: {$name[customer]}<br>
address: {$address[customer]}<br>
<p>
{/section}
OUTPUT:id: 1000<br>
name: John Smith<br>
address: 253 N 45th<br>
<p>
id: 1001<br>
name: Jack Jones<br>
address: 417 Mulberry ln<br>
<p>
id: 1002<br>
name: Jane Munson<br>
address: 5605 apple st<br>
<p>
http://topic.csdn.net/u/20080320/12/3cecdf55-0324-4e56-bd99-fc1eef44d0a9.htmlPS: 失去了用SMARTY的意义了....
后来想了想:
如果你还想用smarty 输出的话, 就在php中将树形结构的数据,输出成二维数组结构。然后传到smarty里面进行输出。
因为不管你数据是如何存的、如何做的无限极,在界面上显示时必定是二维的结构。