smarty 模板中迴圈表格補充不全的td_PHP教程

來源:互聯網
上載者:User
smarty模板中用表格來迴圈讀取資料是一件很糟糕的事情,什麼地方該加標籤,什麼地方該加標籤還好說,如果碰到那種需要加colspan標籤的,那就真得傷一下腦筋了,不過對於這個問題,本人已經想辦法解決了,現特地記載以下,以防在遇到這種情況。具體代碼如,需要根據實際情況進行修改:

{section loop=$student_list name=list}{if $smarty.section.list.first || $smarty.section.list.rownum%5==1}{/if}{$student_list[list].name}{if $smarty.section.list.last == 1 && $smarty.section.list.rownum%5 != 0} {/if}{if $smarty.section.list.last || $smarty.section.list.rownum%5==0}{/if}{/section}

註:上例迴圈的是一個五列的表格

您可能感興趣的文章

  • smarty迴圈表格並補充表格td不足的情況
  • smarty模板中for迴圈的擴充外掛程式
  • smarty模板中使用php函數以及smarty模板中如何對一個變數使用多個函數
  • thinkphp模板中判斷volist迴圈的最後一條記錄
  • smarty模板中給資訊添加最新標籤
  • smarty模板中判斷數組為空白的方法
  • smarty模板中如何產生隨機數
  • 程式中通過define定義的常量如何在smarty模板中使用

http://www.bkjia.com/PHPjc/764169.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/764169.htmlTechArticlesmarty模板中用表格來迴圈讀取資料是一件很糟糕的事情,什麼地方該加tr標籤,什麼地方該加/tr標籤還好說,如果碰到那種需要加colspan標籤...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.