Senin, 29 Agustus 2011

Membuat Recenct documen pada blog

Cara membuat recenct document pada blog sangat mudah caranya adalah:
Loggin Blog-Mu >> Pilih Rancangan >> Page Element >> Add a Gatget >> Html/ Java script, Lali copy- Paste html yang dibawah ini:

<textarea cols="50" name="code" rows="4"><script style="text/javascript">
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(alturl);
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";
var comment = entry.content.$t;
var alamat = entry.author.$t;
var re = /<\S[^>]*>/g;
comment = comment.replace(re, "");
if(entry.author[0].uri){
var uri = entry.author[0].uri.$t;
var urilink = uri.split(":");
urilink = urilink[0];
if (urilink != "http") var uri = "http://" + entry.author[0].uri.$t;
}
else {
var uri = false;
}

if(uri){
if (showcommentdate == true) document.write('<div class="komentar-terbaru">' + '<div class="yang-komentar">' + entry.author[0].name.$t + '</div>');
if (showposttitle == true) document.write('&nbsp;on ' +'<div class="judul">'+ posttitle +'</div>');
document.write(':<br/>'+'</div>');
if (comment.length < numchars)
document.write('<div class="isi">' + comment + '</div>');
else
document.write('<div class="isi">'+ comment.substring(0, numchars) + '...'+'</div>' );
}

else {
if (showcommentdate == true) document.write('<div class="komentar-terbaru">' + '<div class="yang-komentar">' + entry.author[0].name.$t + '</div>');
if (showposttitle == true) document.write('&nbsp;on ' +'<div class="judul">'+ posttitle +'</div>');
document.write(':<br/>'+'</div>');
if (comment.length < numchars)
document.write('<div class="isi">' + comment + '</div>');
else
document.write('<div class="isi">'+ comment.substring(0, numchars) + '...'+'</div>' );
}
}
}</script><script style="text/javascript">var numcomments = 9;var showcommentdate = true;var showposttitle = true;var numchars = 100;</script><script src="http://menteriblog.blogspot.com/feeds/comments/default?max-results=10&alt=json-in-script&callback=showrecentcomments"></script>
</textarea>


 NB: Ganti http://menteriblog.blogspot.com menjadi alamat Url Blog kamu... selamat mencoba ya...

Tidak ada komentar:

Posting Komentar