Smarty模板如何实现有条件的双层嵌套调用? 见http://community.csdn.net/Expert/topic/4293/4293437.xml?temp=.1986658构造出那样的数组很容易的select 字母, 人名 from 表然后在循环读出记录时$ar[字母][child][] = 人名 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 sql语句order by 第一个字母然后嵌套section就行了 我转贴过来吧:Smarty:php:<?php $ar = array(array('char' => 'A','child' => array(array('text' => 'aa'),array('text' => 'aaa'),)), array('char' => 'B','child' => array(array('text' => 'bb'),array('text' => 'bbb'),) ),); $tpl->assign("ar", $ar); $tpl->display('test.htm'); ?> test.htm:<html><head><meta http-equiv="Content-Type" content="text/html; charset=big5"><title></title></head> <body><{section name=sec1 loop=$ar}><{$ar[sec1].char}><br/><{section name=sec2 loop=$ar[sec1].child}><{$ar[sec1].child[sec2].text}><br/><{/section}><{/section}></body></html>是 阿辛的帖子。 $_GET和$变量有什么区别 smarty模板中怎么使用lightbox啊 求教啊 在一个form表单中,存在多个select,递交到后台文件后,如何获取到这几个select被选中的值?? php中如何取得动态获取的IP地址的最后一段数字 请问循环结果没问题 这两个sql语句可以一次执行么? 如何在图片中显示中文(php使用gd库) 用PHP开发论坛,数据库应该如何设计? 好奇:能用PHP+FLASH做实时网络游戏吗? 在线等。及时结贴.新闻内容 如何把mysql两个表中提取出来的两个字段记录合并,并过滤里面的重复记录? 新手问题
<?php
$ar = array(array('char' => 'A','child' => array(array('text' => 'aa'),array('text' => 'aaa'),)),
array('char' => 'B','child' => array(array('text' => 'bb'),array('text' => 'bbb'),) ),
);
$tpl->assign("ar", $ar);
$tpl->display('test.htm');
?> test.htm:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title></title>
</head>
<body>
<{section name=sec1 loop=$ar}>
<{$ar[sec1].char}><br/>
<{section name=sec2 loop=$ar[sec1].child}>
<{$ar[sec1].child[sec2].text}><br/><{/section}>
<{/section}></body>
</html>是 阿辛的帖子。