小菜小弟我又來問有關問題了,各位大俠幫幫忙吧。關於SMARTY 顯示分類有關問題

來源:互聯網
上載者:User
小菜我又來問問題了,各位大俠幫幫忙吧。關於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}
php smarty 分類顯示


------解決方案--------------------

{foreach item=listfl from=$listfl}

{$listfl.name}


{foreach item=sub from=$listfl.sub}
{$sub.name}
------解決方案--------------------

{/foreach}


{/foreach}
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.