小菜我又来问问题了,各位大侠帮帮忙吧。关于SMARTY 显示分类问题
我作一次分类,有顶级分类,二级分类
$questionfl=$page->pagesql("select * from questionfl where sid=false");//查找顶级分类
$q=0;
while($flrows=$questionfl->fetchRow()){
$listfl[$q]["id"]=$flrows["id"];
$listfl[$q]["name"]=$flrows["name"];
$questionsl=$page->pagesql("select * from questionfl where sid='".$listfl[$q]["id"]."'");//二级分类
$s=0;
while($slrows=$questionsl->fetchRow()){
$listsl[$s]["id"]=$slrows["id"];
$listsl[$s]["name"]=$slrows["name"];
$listsl[$s]["sid"]=$slrows["sid"];
$s++;
}
$q++;
}html smarty调用却只能重复显示出顶级分类中的最后一个二级分类。求大侠调教
{section name=listfl loop=$listfl}
- {$listfl[listfl].name}
{section name=listsl loop=$listsl}
{$listsl[listsl].name}|
{/section}
{/section}
------解决方案--------------------
{foreach item=listfl from=$listfl}
- {$listfl.name}
{foreach item=sub from=$listfl.sub}
{$sub.name}
------解决方案--------------------
{/foreach}
{/foreach}









