Did You Know ???    Tips and Tricks     SEO     Blogspot    Wordpress     MORE
: : : EXHANGE LINK : : : Mbah Dukun Bagong | | On-Idea | | Aceh Software | | Aceh Zone | | Menjelma  | | Terselubung Sekali 

April 20, 2011

Creating Widgets Recent Comments

Ponerah- Actually, to display the latest comments added already exist in the default gadget blogspot. But many of the bloggers are reluctant to use it as a less attractive appearance.

The addition of these widgets to display the contents of blog visitors comment on our posts. therefore we need to install this widget for we know that the posts we had no response from visitors to the blog.

If you want to install this widget, please follow these steps :

Log In to your blogger dashboard ---> Click Layout ---> Add a Gadget ---> Choose HTML / JavaScript

Then input the following code
<ul><script style="text/javascript">
function showrecentcomments(json) {
for (var i = 0; i &lt; 5; i++) {
var entry = json.feed.entry[i];
var ctlink;
ate = entry.published.$t; var cdyear
var comment d= commentdate.substring(0,4);
ring(5,7); var cdday = commentdate.substr
var cdmonth = commentdate.subs ting(8,10); var monthnames = new Array(); monthnames[1] = "Jan";
r"; monthnames[5] = "M
monthnames[2] = "Feb"; monthnames[3] = "Mar"; monthnames[4] = "A pay"; monthnames[6] = "Jun"; monthnames[7] = "Jul"; monthnames[8] = "Aug";
hnames[12] = "Dec"; i
monthnames[9] = "Sep"; monthnames[10] = "Oct"; monthnames[11] = "Nov"; mon tf (i == json.feed.entry.length) break; for (var k = 0; k < entry.link.length; k++) {
= ctlink.replace("#", "#comment-"); va
if (entry.link[k].rel == 'alternate') { ctlink = entry.link[k].href; break; } } ctlin kr ptlink = ctlink.split("#"); ptlink = ptlink[0]; var txtlink = ptlink.split("/"); txtlink = txtlink[5];
pttitle.link(ptlink); if ("conte
txtlink = txtlink.split(".html"); txtlink = txtlink[0]; var pttitle = txtlink.replace(/-/g," "); pttitle =nt" in entry) { var comment = entry.content.$t;} else if ("summary" in entry) { var comment = entry.summary.$t;} else var comment = "";
font-size:90%;
var re = /<s[^>]*>/g; comment = comment.replace(re, ""); document.write('<li>'); if (comment.length < 50) { document.write('<div style=
"background-color: #dcdcdc; border: #dcdcdc 1px dashed;margin-right:5px">' + monthnames[parseInt(cdmonth,10)] + ' ' + cdday);
document.write(' - ' + entry.author[0].name.$t + ' commented on');
} else { comment = comment.substring(0, 5
document.write(' ' + pttitle + ':</div>'); document.write(comment) ;0); var quoteEnd = comment.lastIndexOf(" "); comment = comment.substring(0, quoteEnd);
dashed;margin-right:5px">' + monthnames[parseInt(cdmonth,10)] + ' ' + cdday); document.write(' - ' + entry.author[0].name.$t + ' commented on'); document.write(' ' +
document.write('<div style="font-size:90%;background-color: #dcdcdc;border: #dcdcdc 1px pttitle + ':</div>'); document.write(comment + '...<a href="' + ctlink + '">(more)</a>'); } } document.write('</li>'); } </script> <script src="http://ponerah.blogspot.com/feeds/comments/default?alt=json-in-script&callback=showrecentcomments">
</script></ul> <noscript>You need to enable JavaScript to read this.</noscript>

Description:
** for (var i = 0; i &lt; 5; i++) { : Item 5 on this code, means showing ninimal comment number five can be replaced in accordance with the needs of the appearance of comments.
** background-color: #dcdcdc; border: #dcdcdc : This code is to display the color of the background comments. Also can be replaced with a color you like.
** http://ponerah.blogspot.com replace with your blog address


Good Luck
Read more »

0 comments:

Post a Comment

Whois Ponerah

Followers

Supporting