← Back to blog

နောက်ဆုံးတင်ပို့စ်များဖော်ပြခြင်း

How to

အဆင့် (၁) Json Widget အတွက် Javascript ထည့်သွင်းခြင်း

အထက်ပါ ခေါင်းစဉ်ကို ကလစ်နှိပ်၍ ဤပို့စ်၏ လမ်းညွှန်မှုအတိုင်း ပြုလုပ်ပါ။ အကယ်၍ ယခင်က Json Javascript ထည့်သွင်းပြီးဖြစ်ပါက ထပ်မံ၍ ထည့်သွင်းရန် မလိုအပ်တော့ပါ။

အဆင့် (၂) “Latest Post” Widget ထည့်သွင်းခြင်းအောက်တွင် ဖော်ပြထားသော Code အား </b:widget> နှင့် <b:widget id= ……… အကြားတွင် ထည့်ပေးပါ။<b:widget id=’HTML101′ locked=’false’ title=’Latest Posts’ type=’HTML’><b:includable id=’main’> <!– only display title if it’s non-empty –> <b:if cond=’data:title != “”‘> <h2 class=’title’><data:title/></h2> </b:if> <div class=’widget-content’> <data:content/> <ul><div id=’dataPost’/></ul> </div><script type=’text/javascript’>// Developed by Hoctro – All rights reserved 2007// This credit must be included in all your derived usages.// This widget lists the available posts based on the uP.nPost value below// Use -1 if you want them all.var uP = {
nPost : -1
};
var cP = {// private variable to store the total resultstotCount : 0,// the number of elements for each json callincrement : 10,// this is the place to define the blog name for subsequent retrieval dataweb : “pikay.myanmarbloggers.org“,listPosts: function(json, tag) { var text=””; for (var i = 0; i < json.feed.entry.length; i++) { var entry = json.feed.entry[i]; text += “<li>” + “<a href='” + cb.getLink(entry, “alternate”) + “‘>” + cb.getTitle(entry) + “</li>”; } var p = document.createElement(‘span’); document.getElementById(tag).appendChild(p); p.innerHTML = text;},callPostJson: function(json) { this.listPosts(json, “dataPost”);},getCo : function(json) { this.totCount = cb.getTotalResults(json); var count = (uP.nPost < 0) ? this.totCount : uP.nPost; var i=1; while(i<=count) { var incr = (count-i < this.increment) ? count-i+1 : this.increment; cb.search( cP.web, “posts”, i, incr, ‘cP.callPostJson’); if (incr==0) incr=incr+1; i = i+incr; }}};cb.search( cP.web, “posts”, 1, 2, ‘cP.getCo’);</script></b:includable></b:widget>အထက်ပါ Code တွင်var uP = {
nPost : -1
};
မှ -1 နေရာတွင် မိမိဖော်ပြလိုသော ပို့စ် အရေအတွက်အား သက်မှတ်ရန်ဖြစ်သည်။-1 ဟု သက်မှတ်လိုက်လျှင် ပို့စ် အကန့်အသတ် မရှိ ဖော်ပြရန် သက်မှတ်ခြင်းဖြစ်သည်။ထိုနောက် pikay.myanmarbloggers.org နေရာတွင် မိမိ၏ ဘလော့ လိပ်စာ ထည့်ရန်ဖြစ်သည်။

Leave a comment

Your email address will not be published. Required fields are marked *

Discover more from ဖြိုးကျော်နှင့် သူ၏စာများ

Subscribe now to keep reading and get access to the full archive.

Continue reading