在打開單頁日志后產(chǎn)生,每刷新一次,計數(shù)加1。
注意:只有在b_article-single.html有以下及第3步中介紹的代碼,瀏覽計數(shù)才有效。
在b_article-single.html模板中,你認(rèn)為合適的位置加入以下代碼,<span>標(biāo)簽內(nèi)顯示的就是當(dāng)前文章的瀏覽次數(shù)。
<span id="spn<#article/id#>"></span><script type="text/javascript">strBatchCount ="spn<#article/id#>=<#article/id#>,"</script>
只適用在列表頁,如首頁和分類頁。動態(tài)加載,不隨當(dāng)前頁刷新累加。
需要修改b_article-multi.html模板,在你認(rèn)為合適的位置加入以下代碼,span標(biāo)簽就是每個文章的瀏覽次數(shù)。
<span id="spn<#article/id#>"></span><script type="text/javascript">strBatchView ="spn<#article/id#>=<#article/id#>,"</script>
你也可以用<#article/viewnums#>標(biāo)簽,但它只能在索引重建后更新數(shù)值。
在 TEMPLATE/ default.html,single.html,catalog.html 等頁面的頭部和尾部(指<body ></ body>內(nèi))都要有如下代碼計數(shù)器才能正常工作,默認(rèn)模板已經(jīng)包含這些代碼。
TEMPLATE/default.html,single.html,catalog.html頭部代碼
<script type="text/javascript"> var strBatchView=""; var strBatchInculde=""; var strBatchCount="";</script>
TEMPLATE/default.html,single.html,catalog.html尾部代碼
<script type="text/javascript">$(document).ready(function(){try{ var elScript = document.createElement("script"); elScript.setAttribute("language", "JavaScript"); elScript.setAttribute("src", "<#ZC_BLOG_HOST#>function/c_html_js.asp?act=batch" unescape("&") "view=" escape(strBatchView) unescape("&") "inculde=" escape(strBatchInculde) unescape("&") "count=" escape(strBatchCount)); document.getElementsByTagName("body")[0].appendChild(elScript); }catch(e){};});</script>
新聞熱點
疑難解答
圖片精選