Saturday, September 12, 2009

Total Post / Comments Widget ျပဳလုပ္နည္း

B log မွာ မိမိ ေရးထားတဲ႕ Post အေရးအတြက္ ၊ Comments အေရးအတြက္ ဘယ္ေလာက္ရွိတယ္ဆုိတာကုိ ေဖာ္ျပတဲ႕ Widget လုပ္လုိ႕ ရတဲ႕နည္းကုိ တင္ျပမွာျဖစ္ပါတယ္။ မိမိ ေရးထားတဲ႕ Post အေရးအတြက္နဲ႕ Comments အေရးအတြက္ကုိ ေအာက္ပါအတုိင္း တင္ျပေနတာကုိ Sidebar Widget မွာ ေတြ႕ရမွာျဖစ္ပါတယ္။( ကြၽန္ေတာ္ဆိုဒ္မွာေတာ႕ Post အေရးအတြက္ 180 နဲ႕ Comments ကေတာ႕ 0 ျဖစ္ပါတယ္။)




1. မိမိ Blog မွ Layout ကုိ click လုိက္ပါ။
2. Page Elements ကုိ click လုိက္ပါ။
3. Add a Gadget ကုိ click ျပီ HTML / JavaScript ထဲမွာ ေအာက္က code ေတြကုိ ထည္႕လုိက္ပါ။အနီေရာင္နဲ႕ ျပသထားတဲ႕ေနရာမွာ မိမိရဲ႕ Blog လိပ္စာကုိ ထည္႕လုိက္ပါ။

<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://www.knowledgewar07.co.cc/feeds/posts/default?alt=json-in-script&callback=numberOfPosts"></script></li>

<li><script src="http://www.knowledgewar07.co.cc/feeds/comments/default?alt=json-in-script&callback=numberOfComments"></script></li></ul>

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Top WordPress Themes