Home   Best Sellers   Blogging   Coding & Design   Technology   SEO   Travel & living   Career   Videos   Tips   Calculators     
Home  »     »     »     »  Javascript code to display the recent comments of a blogger website on other website

Javascript code to display the recent comments of a blogger website on other website

Sunday, July 27, 2014

Blogger provides option to access your Blogs recent comments. You can access the comment feed of your blogger website using following feed link




http://YOUR_BLOG_ADDRESS.blogspot.com/feeds/comments/default

Ex: http://crozoom.blogspot.com/feeds/comments/default

You can use the following Javascript code to get recent comments on your blog and display it on other website or as a side widget on your blog itself.




copy and paste the following code in your website where you wish to see the comments.


How to show recent comments from a blogger website on another blogger blog?
if you want to show this on a blogger website, then go to the layout section , then Add a new Javascript / HTML widget , save this html code and reload your blog.


<script>
function showrecentcomments(json){for(var i=0;i<a_rc;i++){var b_rc=json.feed.entry[i];var c_rc;if(i==json.feed.entry.length)break;for(var k=0;k<b_rc.link.length;k++){if(b_rc.link[k].rel=='alternate'){c_rc=b_rc.link[k].href;break;}}c_rc=c_rc.replace("#","#");var d_rc=c_rc.split("#");d_rc=d_rc[0];var e_rc=d_rc.split("/");e_rc=e_rc[5];e_rc=e_rc.split(".html");e_rc=e_rc[0];var f_rc=e_rc.replace(/-/g," ");f_rc=f_rc.link(d_rc);var g_rc=b_rc.published.$t;var h_rc=g_rc.substring(0,4);var i_rc=g_rc.substring(5,7);var j_rc=g_rc.substring(8,10);var k_rc=new Array();k_rc[1]="Jan";k_rc[2]="Feb";k_rc[3]="Mar";k_rc[4]="Apr";k_rc[5]="May";k_rc[6]="Jun";k_rc[7]="Jul";k_rc[8]="Aug";k_rc[9]="Sep";k_rc[10]="Oct";k_rc[11]="Nov";k_rc[12]="Dec";if("content" in b_rc){var l_rc=b_rc.content.$t;}else if("summary" in b_rc){var l_rc=b_rc.summary.$t;}else var l_rc="";var re=/<\S[^>]*>/g;l_rc=l_rc.replace(re,"");document.write('<div class="rcw-comments">');if(m_rc==true)document.write('On '+k_rc[parseInt(i_rc,10)]+' '+j_rc+' ');document.write('<span class="author-rc"><a href="'+c_rc+'">'+b_rc.author[0].name.$t+'</a></span> commented');if(n_rc==true)document.write(' on '+f_rc);

if(o_rc==0){
document.write('</div>');
}

else{
document.write(': ');if(l_rc.length<o_rc){document.write('<i>“');document.write(l_rc);document.write('”</i></div>');}else{document.write('<i>“');l_rc=l_rc.substring(0,o_rc);var p_rc=l_rc.lastIndexOf(" ");l_rc=l_rc.substring(0,p_rc);document.write(l_rc+'…”</i></div>');document.write('');}
}
}
}
</script>
<script style=text/javascript >
var a_rc=5;
var m_rc=false;
var n_rc=true;
var o_rc=100;
</script>
<script src="http://crozoom.com/feeds/comments/default?alt=json-in-script&callback=showrecentcomments" ></script>
<style type=text/css> .rcw-comments a {text-transform: capitalize;} .rcw-comments {border-bottom: 1px dotted; padding-top: 7px!important; padding-bottom: 7px!important;} #rcw-cr {font-family: Arial,Tahoma;font-size:9px;padding-top:7px;display:block;} </style>


var a_rc=5; Use this variable to enter number of comment you would like to show

var o_rc=100; Use this variable to enter number of characters you would like to show per comment.

var n_rc=true; hide or show post title

var m_rc=false; hide or show comment date



please replace "crozoom.com" with your blogs address.




How to link to this page?
If you wish to link to this page from your website, simply Copy and paste the above HTML code to your web page. It will appear on your page as:
Javascript code to display the recent comments of a blogger website on other website .




Share this!




comments powered by Disqus

This Weeks 7 Popular Posts


Subscribe to Recent Posts by Email
Stay connected to CROZOOM with regular Email notices of new Techie articles and IT Jobs. Updates will be delivered to your Inbox as soon as they are posted online.

Enter Your Email Address:  

Delivered by FeedBurner   RSS Feed

Search this Blog   



Urgent Openings for PHP trainees, Andriod / IOS developers and PHP developers in Kochi Trivandrum Calicut and Bangalore. Please Send Your updated resumes to recruit.vo@gmail.com   Read more »