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>是 阿辛的帖子。 如何读出这种数据的内容 多谢!!!!! .htacess 文件 redirect 跳转难题 system()函数怎么使用搞不懂啊 帮帮忙 php的输出问题 如何控制输出的字符长度~ PHP网页中的图片和按钮图片是怎么创建的? 循环打印问题 请教:PHP有没有在Linux中读配置文件的函数? imap函数的问题 怎么打印出thinkphp控制器下的所有方法 求助,要在html页面嵌套一个PHP页面怎么做啊 如何把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>是 阿辛的帖子。