kp3နည္းပညာ၊၈၇၊Recent Comments ေတြကို Summariesနဲ႕လုပ္ခ်င္ရင္

Posted by KP-3မိသားစု | Labels:

ဒီေန႕က်ေနာ္တင္မယ့္ Post ေလးကေတာ့ဘေလာ့Recent Comments ေတြကို Summaries
နဲ႕လုပ္ျခင္ရင္ေပါ့ေနာ္၊သိျပီးၾကသူေတြလည္းမ်ားပါတယ္။အခုလက္ရွိသံုးတဲ့ဘေလာ့ဂါမိတ္ေဆြ
လည္းမ်ားပါတယ္၊မသိၾကေသးတဲ့သူငယ္ခ်င္းေတြရွိခဲ့ေသာ္သံုးလို႕ရေအာင္ပါ။အားလံုးကိုလည္း
အစဥ္ျမဲေလးစားလၽွက္ပါ။
ေအာက္မွာထည့္နည္းနွင့္တကြ Code

၁။ Layout.

၂။ Page Elements.

၃။ Add a Gadget.

၄။ HTML / Javascript.

<ul style="font-style: italic;"><script style="text/javascript
">
function showrecentcomments(json) {
for (var i = 0; i < 20; i++) {
var entry = json.feed.entry[i];
var ctlink;

if (i == json.feed.entry.length) break;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
ctlink = entry.link[k].href;
break;
}
}
ctlink = ctlink.replace("#", "#comment-");
var ptlink = ctlink.split("#");
ptlink = ptlink[0];
var txtlink = ptlink.split("/");
txtlink = txtlink[5];
txtlink = txtlink.split(".html");
txtlink = txtlink[0];
var pttitle = txtlink.replace(/-/g," ");
pttitle = pttitle.link(ptlink);
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('<li style="text-align:left">');
document.write('<a href="' + ctlink + '">' +
entry.author[0].name.$t + '</a>');
document.write(' on ' + pttitle);
document.write('<br>');
if (comment.length < 150) {
document.write(comment + '...<a href="' + ctlink + '"> (more)
</a><br><br>');
}
else
{
comment = comment.substring(0, 150);
var quoteEnd = comment.lastIndexOf(" ");
comment = comment.substring(0, quoteEnd);
document.write(comment + '...<a href="' + ctlink + '"> (more
)</a><br><br>');
}
}
document.write('</li>');
}
</script>
<script src="http://ဘေလာ့အမည္ထည့္ပါ.blogspot.com/feeds/comments/
default?alt=json-in-script&callback=showrecentcomments">
</script></ul>


၅။Save နိုပ္လိုက္ပါ။
ဘေလာ့ဂါမိတ္ေဆြအားလံုးကိုအစဥ္ျမဲခ်စ္ခင္ေလးစားလၽွက္ kp3မိသားစု



Related Post:

0 comments:

Post a Comment