Home  >  Article  >  Backend Development  >  小菜小弟我又来问有关问题了,各位大侠帮帮忙吧。关于SMARTY 显示分类有关问题

小菜小弟我又来问有关问题了,各位大侠帮帮忙吧。关于SMARTY 显示分类有关问题

WBOY
WBOYOriginal
2016-06-13 11:10:28846browse

小菜我又来问问题了,各位大侠帮帮忙吧。关于SMARTY 显示分类问题
我作一次分类,有顶级分类,二级分类

$questionfl=$page->pagesql("select * from questionfl where sid=false");//查找顶级分类<br />$q=0;<br />while($flrows=$questionfl->fetchRow()){<br />	$listfl[$q]["id"]=$flrows["id"];<br />	$listfl[$q]["name"]=$flrows["name"];<br /><br />	$questionsl=$page->pagesql("select * from questionfl where sid='".$listfl[$q]["id"]."'");//二级分类<br />	$s=0;<br />	while($slrows=$questionsl->fetchRow()){<br />		$listsl[$s]["id"]=$slrows["id"];<br />		$listsl[$s]["name"]=$slrows["name"];<br />		$listsl[$s]["sid"]=$slrows["sid"];<br />		$s++;<br />	}<br />	$q++;<br />}


html smarty调用却只能重复显示出顶级分类中的最后一个二级分类。求大侠调教
{section name=listfl loop=$listfl}<br />      <dl class="qa_sort"><br />        <dt><a href="#">{$listfl[listfl].name}</a></dt><br />        <dd><br />        	{section name=listsl loop=$listsl}<br />        	<a href="#">{$listsl[listsl].name}</a>|<br />			{/section}<br />		</dd><br />      </dl><br />	  {/section}

php smarty 分类显示
------解决方案--------------------
<br />{foreach item=listfl from=$listfl}<br />  <dl class="qa_sort"><br />	<dt><a href="#">{$listfl.name}</a></dt><br />	<dd><br />		{foreach item=sub from=$listfl.sub}<br />		<a href="#">{$sub.name}</a><br><font color='#FF8000'>------解决方案--------------------</font><br><br />		{/foreach}<br />	</dd><br />  </dl><br />{/foreach}<br />
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn