Hiển thị tổng số bài viết, nhận xét trên blog

Sunday, July 12, 2009
Các bạn nhìn thấy trong blog của mình có mục "Total post, Total comments". Đó là tổng số bài viết và nhận xét trên blog của mình. Làm thế nào để hiển thị được những thông số này? Các bạn làm theo hướng dẫn sau đây.


Chọn Layout > Page Elements > Add a gadget > HTML /Java script paste đoạn code sau vào khung nhập liệu.
<script style="text/javascript">
function numberOfPosts(json) {
document.write('Total posts: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
}
function numberOfComments(json) {
document.write('Total comments: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
}
</script>
<ul><li><script src="http://yoursite.blogspot.com/feeds/posts/default?alt=json-in-script&callback=numberOfPosts"></script></li>
<li><script src="http://yoursite.blogspot.com/feeds/comments/default?alt=json-in-script&callback=numberOfComments"></script></li></ul>
Thay Yoursite bằng địa chỉ blog của bạn. Có thể thay đổi cụm từ "Total posts, Total comments" bằng cái gì bạn muốn.
Bạn có thể cập nhật bài viết mới từ Blogger+ một cách nhanh nhất bằng cách:

Đăng ký nhận tin RSS;

Đăng ký nhận bài viết mới qua Email.


Copyright 2008 - 2022 - BloggerPlus.net. All rights reserved.
Ghi rõ nguồn khi phát hành lại thông tin từ trang này.
Designed by Pavel. Powered by Blogger
Based on CSS by Ourblogtemplates