destoon實(shí)現(xiàn)底部添加你是第幾位訪問者的方法
經(jīng)常會(huì)看到一些網(wǎng)站有類似“您是第位訪客”字樣的計(jì)數(shù)統(tǒng)計(jì),這里我們來實(shí)現(xiàn)把這個(gè)統(tǒng)計(jì)功能添加到destoon的底部,顯示“你是第幾問訪問者”的效果。此處的計(jì)數(shù)器與網(wǎng)站流量統(tǒng)計(jì)有區(qū)別,記錄的是刷新次數(shù),并不是真實(shí)記錄訪問者的IP,對(duì)于需要真正進(jìn)行統(tǒng)計(jì)的朋友可以進(jìn)一步完善代碼以滿足自身需求。
下面就來說一下具體的實(shí)現(xiàn)方法:
打開底部footer.htm的文件,找到<a href="{$MODULE[1][linkurl]}" rel="external nofollow" >返回首頁(yè)</a>,在后面加上這段代碼:
<script language="JavaScript"> <!-- var caution = false function setCookie(name, value, expires, path, domain, secure) { var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "") if (!caution || (name + "=" + escape(value)).length <= 4000) document.cookie = curCookie else if (confirm("Cookie exceeds 4KB and will be cut!")) document.cookie = curCookie } function getCookie(name) { var prefix = name + "=" var cookieStartIndex = document.cookie.indexOf(prefix) if (cookieStartIndex == -1) return null var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length) if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length return (document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex)) } function deleteCookie(name, path, domain) { if (getCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT" } } function fixDate(date) { var base = new Date(0) var skew = base.getTime() if (skew > 0) date.setTime(date.getTime() - skew) } var now = new Date() fixDate(now) now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000) var visits = getCookie("counter") if (!visits) visits = 1 else visits = parseInt(visits) + 1 setCookie("counter", visits, now) document.write("您是第 " + visits + " 個(gè)來到本站訪客") // --> </script>
- destoon調(diào)用discuz論壇中帶圖片帖子的實(shí)現(xiàn)方法
- destoon調(diào)用企業(yè)會(huì)員公司形象圖片的實(shí)現(xiàn)方法
- destoon實(shí)現(xiàn)調(diào)用當(dāng)前欄目分類及子分類和三級(jí)分類的方法
- destoon實(shí)現(xiàn)VIP排名一直在前面排序的方法
- Destoon實(shí)現(xiàn)多表查詢示例
- destoon首頁(yè)調(diào)用求購(gòu)供應(yīng)信息的地區(qū)名稱的方法
- destoon實(shí)現(xiàn)調(diào)用熱門關(guān)鍵字的方法
- destoon實(shí)現(xiàn)資訊信息前面調(diào)用它所屬分類的方法
- destoon實(shí)現(xiàn)首頁(yè)顯示供應(yīng)、企業(yè)、資訊條數(shù)的方法
- destoon實(shí)現(xiàn)公司新聞詳細(xì)頁(yè)添加評(píng)論功能的方法
- destoon數(shù)據(jù)庫(kù)表說明匯總
- destoon切換城市后實(shí)現(xiàn)logo旁邊顯示地區(qū)名稱的方法
相關(guān)文章
PHP實(shí)現(xiàn)長(zhǎng)文章分頁(yè)實(shí)例代碼(附源碼)
當(dāng)文章內(nèi)容比較長(zhǎng),為了更好的滿足用戶體驗(yàn)度,我們將文章內(nèi)容分頁(yè)顯示處理,而一般分頁(yè)處理是在后臺(tái)發(fā)布文章的時(shí)候就將提交的內(nèi)容生成多個(gè)分頁(yè)后的靜態(tài)文件。通過本文結(jié)合實(shí)例采用php動(dòng)態(tài)將長(zhǎng)文章內(nèi)容進(jìn)行分頁(yè)處理2016-02-02php while循環(huán)得到循環(huán)次數(shù)
在for循環(huán)中,我們很容易得到循環(huán)次數(shù),因?yàn)槭亲鳛闂l件出現(xiàn)的。在while也可以得到,如下:2013-10-10visual studio code 調(diào)試php方法(圖文詳解)
本篇文章主要介紹了visual studio code 調(diào)試php方法(圖文詳解),具有一定的參考價(jià)值,有興趣的可以了解一下2017-09-09Laravel搭建后臺(tái)登錄系統(tǒng)步驟詳解
這篇文章主要介紹了Laravel搭建后臺(tái)登錄系統(tǒng)的方法,結(jié)合實(shí)例形式詳細(xì)分析了Laravel搭建后臺(tái)登錄系統(tǒng)所涉及的安裝、配置、數(shù)據(jù)庫(kù)操作等具體步驟與實(shí)現(xiàn)方法,需要的朋友可以參考下2016-07-07Yii2中關(guān)聯(lián)查詢簡(jiǎn)單用法示例
這篇文章主要介紹了Yii2中關(guān)聯(lián)查詢簡(jiǎn)單用法,涉及Yii2的數(shù)據(jù)庫(kù)查詢方法及鏈?zhǔn)讲僮骱?jiǎn)單使用技巧,需要的朋友可以參考下2016-08-08php二維數(shù)組用鍵名分組相加實(shí)例函數(shù)
php二維數(shù)組以鍵名進(jìn)行分組相加的實(shí)例程序2013-11-11