迅睿CMS框架是一款PHP8高性能·簡單易用的CMS開源開發框架,基于MIT開源許可協議發布,免費且不限制商業使用,是免費開源的產品,以萬端互聯為設計理念,支持的微信公眾號、小程序、APP客戶端、移動端網站、PC網站等多終端式管理系統。
聯系官方銷售客服
1835022288
028-61286886
模板標簽里面
怎么計算category循環出來的10個欄目的本周數據之和,參照http://www.zbshanke.com/doc/1114.html 這個教程,調用不出來
代碼如下
<table class="layui-table"> <thead> <tr> <th>序號</th> <th>單位</th> <th>數量</th> </tr> </thead> <tbody> {category module=news pid=2 num=5,10 cache=3600} <tr> <td>{$key+1}</td> <td>{$t.name}</td> <td>{count action=module module=news catid=$t.id WEEK_updatetime=0 return=l}{$l_count}</td> </tr> {/category} <tr> <td>合計</td> <td colspan="2">{sum sum=$l_count action=module module=news catid=16,17,18,19,20,21,22,23,24,25 WEEK_updatetime=0 return=h}{$h_sum}</td> </tr> </tbody> </table>
category標簽的num不支持5,10的寫法
{php $cts=0;} {category module=news pid=2 num=10 cache=3600} <tr> <td>{$key+1}</td> <td>{$t.name}</td> <td>{count action=module module=news catid=$t.id WEEK_updatetime=0 return=l}{php $cts+=$l_count}</td> </tr> {/category} 之和的數據{$cts}
回復@迅睿框架技術-徐老師 理論上category標簽是不支持num=5,10 但是我在實際使用過程中,就是按照我想顯示的效果顯示出來了對應的欄目。另外用你的方法合計是顯示出來了,但是欄目后面的數量沒有顯示
{php $cts=0;} {category module=news pid=2 num=10 cache=3600} <tr> <td>{$key+1}</td> <td>{$t.name}</td> <td>{count action=module module=news catid=$t.id WEEK_updatetime=0 return=l}{php $cts+=$l_count; echo $l_count;}</td> </tr> {/category} 之和的數據{$cts}
回復@迅睿框架技術-徐老師 感謝解答,完美解決
代碼如下
category標簽的num不支持5,10的寫法
回復@迅睿框架技術-徐老師 理論上category標簽是不支持num=5,10 但是我在實際使用過程中,就是按照我想顯示的效果顯示出來了對應的欄目。另外用你的方法合計是顯示出來了,但是欄目后面的數量沒有顯示
回復@迅睿框架技術-徐老師 感謝解答,完美解決