Tutorial Komen Terbaru untuk blogger


Hai Semua. Hari ini saya ingin berkongsi sedikit pengetahuan dengan anda tentang widget recent comment untuk blogger. Ada pelbagai cara dan macam-macam fesyen yang orang guna untuk membuat widget komen terbaru di blog mereka. Dulu saya pun tak pandai nak buat ini semua. Tapi sekarang al-hamdulillah, berkat kesabaran dan doa kepada Tuhan, akhirnya Tuhan telah memberi ilham kepada saya untuk mengeluarkan entry ini untuk dikongsikan bersama. Semoga ianya memberi manfaat buat anda semua.


  • Pertama sekali, anda perlulah login ke akaun blogger anda.
  • Kemudian, masuk ke menu Design - Page Elements. Tambahkan widget baru dan pilih HTML/Javascript.
  • Dan salin script di bawah ini, lalu lekatkan pada ruang HTML/Javascript anda tadi.

<style type="text/css">
#mykomenluar{margin:0px auto;}
#mykomendlm {
background-color: #E6E7F6;
border: 1px solid #727FE1;
border-radius:5px;
overflow-y: scroll;
width: 270px;
height: 300px;
font-size:10px;
text-align: left;
margin:0px auto;
padding:10px;
}
#mykomendlm a{color:#555;font-weight:bold;}
</style>
<div id="mykomenluar">
<div id="mykomendlm"><script style="text/javascript"> function showrecentcomments(json) { var numcomments = 20; var showcommentdate = true; var showposttitle = true; var numchars = 100; 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, ""); 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> berkomentar'); if (showposttitle == true) document.write(' di ' + posttitle); document.write('<br/>'); if (comment.length < numchars) { document.write('<i>'); document.write(comment); document.write('</i>');} else { document.write('<i>'); comment = comment.substring(0, numchars); var quoteEnd = comment.lastIndexOf(" "); comment = comment.substring(0, quoteEnd); document.write(comment + '...<a href="' + alturl + '">(selanjutnya)</a>'); document.write('</i>');} document.write('<br/>'); } document.write('<br/>'); } </script> <script src="http://www.yourblogURL.com/feeds/comments/default?alt=json-in-script&callback=showrecentcomments"> </script></div></div>

Kemudian tukarkan tulisan yang berwarna merah http://www.yourblogURL.com dengan URL anda.
Anda juga boleh mengubah suai background dan sebagainya di dalam CSS code yang disediakan.
Selamat mencuba :)

4 Comments

Please leave your ideas here

  1. My paгtner anԁ I stumbled oѵeг hегe ԁiffегent wеbsіtе and thought I ѕhould chесk things out.
    I liκe ωhаt I sее so
    now i'm following you. Look forward to looking at your web page for a second time.

    Here is my web page :: SEO Wordpress Plugin

    ReplyDelete
  2. I every time spеnt my half an hour to reаd this blog's posts every day along with a mug of coffee.

    Here is my site; because i said so wedding cake
    Also see my site - al's wedding candids

    ReplyDelete
  3. Fantaѕtic gοods from you, mаn.

    I have underѕtand уour stuff preνious
    to and yοu're just too wonderful. I actually like what you'ѵe acquired
    here, ceгtainly like what you are stаting and
    the waу in which you say it. Yοu make іt еntertaining anԁ yοu
    still take cаre of to keep іt wise. I сan't wait to read much more from you. This is actually a tremendous web site.

    Feel free to visit my page Www.Facebook.Com
    Also see my website - Get Wordpress Plugin

    ReplyDelete
  4. Thаnk уou for another excellent post.
    Τhe place еlse may juѕt anуbody get that tyрe of info in such аn idеаl aρprοaсh of writing?
    I havе a pгesentation next weeκ, and I am
    at the ѕeaгch foг such info.


    Τaκe a look at mу blog wedding dresses
    My web page > wedding dresses

    ReplyDelete
Post a Comment
Previous Post Next Post