/

Full Source Code "Recent Comments" For Blogger Beta

Several colleagues sent me an email and ask if I have the source code for the "Recent Comments" or what we call the "Recent Comments". If not mistaken there are 5 emails asking the same thing, from my reply to these emails one by one my better posts on this blog alone, the source code is not made by me but made by Hans Oosting which is located at http://beautifulbeta.blogspot.com. With the source code itself, we can also edit the "Recent Comments" in accordance with the desire, which is evident if we already have basic programming can certainly edit the code easily, do not forget do not change the original source code maker yes ...



Source code consists of two parts, the code the first part of this code can be inserted where aja long as we have storage space on the web directory. if you do not have enough storage directory on the web site we can use free services like http://www.geocities.com or http://www.tripod.com Before performing the upload process is a good idea first to open notepad or any text editor tools, then copy-paste the code below store with a name (eg: recentcomments.txt). If the file name has been created to do upload as usual, sure I can do khan:). When using our live service http://www.geocities.com kemudina login to File Manager - typing its file name and then click the new button, delete all the text then copy and paste on the last page and do not forget to save:)



The first section code:




// ----------------------------------------




// SHOW RECENT COMMENTS


// ----------------------------------------


// This functions takes a blogger-feed in JSON


// format and displays it.


//


// Version    : 2.1


// Date        : 2007-02-02




// Author     : Hans Oosting


// URL        : beautifulbeta.blogspot.com


// ----------------------------------------







function showrecentcomments(json) {


for (var i = 0; i < numcomments; i++) {




var entry = json.feed.entry[i];


var alturl;





if (i == json.feed.entry.length) break;


for (var k = 0; k < entry.link.length; k++) {


if (entry.link[k].rel == 'alternate') {


alturl = entry.link[k].href;


break;




}


}


alturl = alturl.replace("#", "#comment-");


var postlink = alturl.split("#");


postlink = postlink[0];


var linktext = postlink.split("/");


linktext = linktext[5];


linktext = linktext.split(".html");


linktext = linktext[0];




var posttitle = linktext.replace(/-/g," ");


posttitle = posttitle.link(postlink);


var commentdate = entry.published.$t;


var cdyear = commentdate.substring(0,4);


var cdmonth = commentdate.substring(5,7);


var cdday = commentdate.substring(8,10);


var monthnames = new Array();


monthnames[1] = "Jan";


monthnames[2] = "Feb";




monthnames[3] = "Mar";


monthnames[4] = "Apr";


monthnames[5] = "May";


monthnames[6] = "Jun";


monthnames[7] = "Jul";


monthnames[8] = "Aug";


monthnames[9] = "Sep";


monthnames[10] = "Oct";


monthnames[11] = "Nov";




monthnames[12] = "Dec";


if ("content" in entry) {


var comment = entry.content.$t;}


else


if ("summary" in entry) {


var comment = entry.summary.$t;}


else var comment = "";


var re = /<\S[^>]*>/g;




comment = comment.replace(re, "");


if (!standardstyling) document.write('<div class="bbrecpost">');


if (standardstyling) document.write('<br/>');


if (showcommentdate == true) document.write('On ' +

monthnames[parseInt(cdmonth,10)] + ' ' + cdday + ' ');


document.write('<a href="' + alturl + '">' + entry.author[0].name.$t + '</a>



commented');


if (showposttitle == true) document.write(' on ' + posttitle);


if (!standardstyling) document.write('</div><div class="bbrecpostsum">');


if (standardstyling) document.write('<br/>');


if (comment.length < numchars) {




if (standardstyling) document.write('<i>');


document.write(comment);


if (standardstyling) document.write('</i>');}


else


{


if (standardstyling) document.write('<i>');




comment = comment.substring(0, numchars);


var quoteEnd = comment.lastIndexOf(" ");


comment = comment.substring(0, quoteEnd);


document.write(comment + '...<a href="' + alturl + '">(more)</a>');


if (standardstyling) document.write('</i>');}


if (!standardstyling) document.write('</div>');




if (standardstyling) document.write('<br/>');


}


if (!standardstyling) document.write('<div class="bbwidgetfooter">');


if (standardstyling) document.write('<br/>');


document.write('<span style="font-size:80%;">Widget by <a href="http://hackosphere.blogspot.com">Hackosphere</a><br/>Powered

by <a href="http://beautifulbeta.blogspot.com">Beautiful Beta</a></span>');




if (!standardstyling) document.write('</div>');


}





To do memanggilan the above code we just use the code below, how to live copy and paste the code input element on the page bloggers.



The second part code:



<script style="text/javascript" src="http://www.geocities.com/oom_directory//recentcomments.txt"></script><script

style="text/javascript">var numcomments = 5;var showcommentdate = true;var

showposttitle = true;var numchars = 100;var standardstyling =

true;</script><script src="http://
o-om.blogspot.com/feeds/comments/default?alt=json-in-script&callback=showrecentcomments"></script>



Do not forget to change the code in the code of the second part, the changes can dilihta in red and pink colors.



In red: Address where we store the first code section

In the pink: Replace with your blog address




Related Post



RSS Feed

0 Comments for Full Source Code "Recent Comments" For Blogger Beta

Leave a comment!

design by tikimedia © 2010 | Converted to Blogger by Blogger Templates | I Powered by Blogger