常看到別人的回應留言區有這個功能,在部落格裡喊話,幾樓的聽到了嗎?覺得很有趣,這個留言編號的功能讓部落格主和網友的回應不僅是一對一的直來直往,更能交叉留言,讓部落格上的消息傳遞更迅速與多樣化。
原先模板記得備份,進入後台,版面配置→修改Html→勾選"展開小裝置範本"
先在CSS程式區,找到Comment這區(將它放在 ]]></b:skin> 之前即可),加入下列定義:
.comment-number {
float: right;
display: block;
width: 50px;
margin-right: 5px;
margin-top: 0px; /*comments-counter position*/
text-align: right;
font-family: 'Century Gothic','Lucida Grande',Arial,Helvetica,Sans-Serif;
font-size: 24px;
line-height:26px;
font-weight: bold;
}
/*since the numbers are actually links, we need to force the color properties*/
.comment-number a:link, .comment-number a:visited {color: #445566 !important; text-decoration: none !important;text-decoration: none;}
.comment-number a:hover, .comment-number a:active {color: #FF9933 !important; text-decoration: none !important;}
然後找到'comments-block'這個關鍵字,你會發現變成有兩段語法,一個是原先的意見區位的設定,另一個就是後來新增留言者大頭的區位,我們要修改的是第二段的'comments-block',類似以下這樣,。
<dl expr:class='data:post.avatarIndentClass' id='comments-block'>
<b:loop values='data:post.comments' var='comment'>
你在這兩行中間插入:
<script type='text/javascript'>var CommentsCounter=0;</script>
然後再下方一點,找到
<data:commentPostedByMsg/> 在下方加入以下語法即可,
<span class='comment-number'>
<a expr:href='"#comment-" + data:comment.id' title='Comment Link'>
<script type='text/javascript'>
CommentsCounter=CommentsCounter+1;
document.write(CommentsCounter)
</script>
</a>
</span>
可能有些模板不適合。