Slider

Study

CSS

About us

Recent Tube

Wisata

News Scroll

Favourite

Event

Culture

Gallery

» » Modify Form comment : Bài 8 - Tạo số đếm cho các comment

Comment numbering in Blogger
[FD's BlOg] - Thêm một thủ thuật nữa để trang trí cho form comment của bạn, thủ thuật sẽ tự động đánh số thứ tự cho các bài comment.


Hình minh họa:


☼ Bắt đầu thủ thuật:
1. Đăng nhập blog
2. Vào bố cục
3. Vào Chỉnh sửa code HTML
4. Chọn mở rộng mẫu tiện ích
5. Chèn đọan code CSS bên dưới vào trước dòng code ]]></b:skin>

.numberingcomments{
float: right;
display: block;
width: 50px;
margin-right: 5px;
margin-top: -35px;
text-align: right;
font-family: Arial,Helvetica,Sans-Serif;
font-size: 15px;
font-weight: bold;
}

6. Tiếp tục xuống phía dưới, tìm đọan code như bên dưới:

<dl id='comments-block'>
<b:loop values='data:post.comments' var='comment'>
<dt class='comment-author' expr:id='"comment-" + data:comment.id'>
<a expr:name='"comment-" + data:comment.id'/>
<b:if cond='data:comment.authorUrl'>
<a expr:href='data:comment.authorUrl' rel='nofollow'><data:comment.author/></a>
<b:else/>
<data:comment.author/>
</b:if>
<data:commentPostedByMsg/>
</dt>
<dd class='comment-body'>
<b:if cond='data:comment.isDeleted'>
<span class='deleted-comment'><data:comment.body/></span>
<b:else/>
<p><data:comment.body/></p>
</b:if>
</dd>
<dd class='comment-footer'>
<span class='comment-timestamp'>
<a expr:href='"#comment-" + data:comment.id' title='comment permalink'>
<data:comment.timestamp/>
</a>
<b:include data='comment' name='commentDeleteIcon'/>
</span>
</dd>
</b:loop>
</dl>


7. Thay thế tất cả bằng đọan code bên dưới:

<dl id='comments-block'>

<script type='text/javascript'>
var CommentsCounter=0;
</script>


<b:loop values='data:post.comments' var='comment'>

<div class='' expr:id='data:comment.id'>

<dt expr:class='"comment-author " + data:comment.authorClass' expr:id='data:comment.anchorName'>
<a expr:name='data:comment.anchorName'/>
<b:if cond='data:comment.authorUrl'>
<a expr:href='data:comment.authorUrl'><data:comment.author/></a>
<b:else/>
<data:comment.author/>
</b:if>
<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>

</dt>
<dd class='comment-body'>
<b:if cond='data:comment.isDeleted'>
<span class='deleted-comment'><data:comment.body/></span>
<b:else/>
<p><data:comment.body/></p>
</b:if>
</dd>
<dd class='comment-footer'>
<span class='comment-timestamp'>
<a expr:href='data:comment.url' title='comment permalink'>
<data:comment.timestamp/>
</a>
<b:include data='comment' name='commentDeleteIcon'/>
</span>
</dd>

</div>

</b:loop>
</dl>


8. Save template.

Nguồn : Blog Anol

Chúc các bạn thành công.

«
Next
Newer Post
»
Previous
Older Post

No comments:

Leave a Reply