解決lcx區塊歸零時的無數字顯示

XOOPS

lcx block  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>