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.
Theo dõi Blogger+ để nhận bài viết mới nhất:

Đăng ký RSS Feed

Copyright 2008 - 2025 - BloggerPlus.space. 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