logcounterx 模組的網站計數器區塊,統計數字欄若採用文字模式,當「今天」、「本週」或「本月」歸零的時候,便會出現空空如上圖箭頭所示的沒有數字狀態,要讓它顯示「0」,可以用如下的修改法。
以下是modules/logcounterx/templates/block/lcx_block_display.html 的檔案內容。統計數字若採用文字模式,會顯示下面橘色部份的語法;用圖片模式的話便顯示黑色這部份。
![]()
![]()
<table>
<{foreach item=count from=$block.counts}>
<{if $block.use_char}>
<{* Display Counter by Letters from here *}>
<tr><td nowrap="nowrap"><{$count.title}></td>
<td align="right" nowrap="nowrap"><span style="<{$block.style}>"><{$count.count}></span></td></tr>
<{* Display Counter by Letters end here *}>
<{else}>
<{* Display Counter by Images from here *}>
<tr><td nowrap="nowrap"><{$count.title}></td>
<td align="right" nowrap="nowrap"><{foreach item=digit from=$count.digits}><img src="<{$xoops_url}>/modules/logcounterx/images/<{$block.imagedir}><{$digit}>.gif" alt="<{$count.count}>" border="0" <{$block.imageattr}>/><{/foreach}></td></tr>
<{* Display Counter by Images end here *}>
<{/if}>
<{/foreach}>
</table>
要讓文字模式下歸零時顯示「0」,可以在文字模式的smarty語法裡加入如下橘色的變數修飾字:
![]()
![]()
<tr><td nowrap="nowrap"><{$count.title}></td>
<td align="right" nowrap="nowrap"><span style="<{$block.style}>"><{$count.count|default:0}></span></td></tr>
這樣當歸零時便會顯示「0」了。