小菜我又来问问题了,各位大侠帮帮忙吧。关于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++;
}
{section name=listfl loop=$listfl}php smarty 分类显示
<dl class="qa_sort">
<dt><a href="#">{$listfl[listfl].name}</a></dt>
<dd>
{section name=listsl loop=$listsl}
<a href="#">{$listsl[listsl].name}</a>|
{/section}
</dd>
</dl>
{/section}
{foreach item=listfl from=$listfl}
<dl class="qa_sort">
<dt><a href="#">{$listfl.name}</a></dt>
<dd>
{foreach item=sub from=$listfl.sub}
<a href="#">{$sub.name}</a>
[解决办法]
{/foreach}
</dd>
</dl>
{/foreach}