လောကမှာ ကတ်သီးကတ်သပ် ဖြစ်နေတာတွေ အများကြီးပါ။ တကယ်တမ်း ကျွန်တော်က ကပ်တာ မဟုတ်ပါဘူး။ စဉ်းစားကြည့်လေ၊ ပီကေက သူ့ဖာသာ မကပ်ပါဘူး။ သူ့ကို တစ်ခုခုက လာကပ်လို့ နေမှာပေါ့။

Tab ပံုစံျဖင့္ ျမင္ႏိုင္ေသာ Widget ျပဳလုပ္ျခင္း

12 July 2007


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

အထက္ပါ ေခါင္းစဥ္ကို ကလစ္ႏွိပ္၍ ဤပို႔စ္၏ လမ္းၫႊန္မႈအတုိင္း ျပဳလုပ္ပါ။ အကယ္၍ ယခင္က Json Javascript ထည့္သြင္းၿပီးပါက ထပ္မံ၍ ထည့္သြင္းရန္ မလုိအပ္ေတာ့ပါ။

အဆင့္ (၂) Tab စတိုင္ သတ္မွတ္ျခင္း

ေအာက္တြင္ ေဖာ္ျပထားေသာ Code မ်ားကို အဆင့္ (၁) မွ Code ၏ ေအာက္နား သို႔မဟုတ္ </head> ၏ အထက္နားတြင္ ထည့္သြင္းေပးပါ။

<link href='http://yui.yahooapis.com/2.3.0/build/tabview/assets/tabview.css' rel='stylesheet' type='text/css'/>
<link href='http://yui.yahooapis.com/2.3.0/build/tabview/assets/border_tabs.css' rel='stylesheet' type='text/css'/>

<script src='http://yui.yahooapis.com/2.3.0/build/yahoo-dom-event/yahoo-dom-event.js' type='text/javascript'/>
<script src='http://yui.yahooapis.com/2.3.0/build/element/element-beta-min.js' type='text/javascript'/>
<script src='http://yui.yahooapis.com/2.3.0/build/tabview/tabview-min.js' type='text/javascript'/>

<style type='text/css'>

.yui-content {
padding:1em; /* pad content container */
}

.yui-navset .yui-content {
border:1px solid #ccc;
}
.yui-navset .yui-nav .selected a, .yui-navset .yui-nav a:hover {
background-color:#fff;
}

.yui-navset .yui-nav li a {
background:#e5e5e5 url(http://developer.yahoo.com/yui/examples/tabview/img/round_4px_trans_gray.gif) no-repeat;
}
.yui-navset .yui-nav li a em {
background:transparent url(http://developer.yahoo.com/yui/examples/tabview/img/round_4px_trans_gray.gif) no-repeat top right;
padding:0.5em;
}

/* top oriented */

.yui-navset-top .yui-nav { margin-bottom:-1px; } /* for overlap, based on content border-width */
.yui-navset-top .yui-nav li a {
border-bottom:1px solid #ccc;
}

.yui-navset-top .yui-nav .selected a { border-bottom:0; }
.yui-navset-top .yui-nav .selected a em { padding-bottom:0.6em; } /* adjust height */
</style>

အဆင့္ (၃) Tabview Widget ထည့္သြင္းျခင္း

ေအာက္တြင္ ေဖာ္ျပထားေသာ Code အား </b: widget> ႏွင့္ <b: widget id=" ..... အၾကားတြင္ ထည့္သြင္းေပးပါ။

<b:widget id='HTML102' locked='false' title='MultiTab Widget' type='HTML'>
<b:includable id='main'>
<div class='widget-content'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'
></h2>
</b:if>
<div id='doc'>
<div>
<h2>Hoctro's Place</h2>
<div class='yui-navset' id='multiTab1'/>
</div>

</div>
<div id='103'/>
</div>

<script type='text/javascript'>
// Developed by Hoctro - All rights reserved 2007
// This credit must be included in all your derived usages.
var p1 = document.createElement('h6');
document.getElementById('103').appendChild(p1);
p1.innerHTML = cb.txt('TabView');

function listOneTab(json, tabView, title, act) {
var label = '';
var text = '';
var nPost = 10;

if (title == "")
label += cb.getLabelFromURL(json);
else
label += title;

text += "<div id='" + label + "'><ul>";

var numberPost = (json.feed.entry.length <= nPost) ?
json.feed.entry.length : nPost;

for (var i = 0; i < numberPost; i++) {
var entry = json.feed.entry[i];
text += "<li>" + "<a href='" + cb.getLink(entry, "alternate")
+ "'>" + cb.getTitle(entry) + "</li>";
}

text += '</ul></div>';

tabView.addTab( new YAHOO.widget.Tab({
label: label,
content: text,
active : act
}));


}

var blog1 = "hoctro.blogspot.com";
var tabView1 = new YAHOO.widget.TabView('multiTab1');
var labels1 = ['JSON Hacks', 'Label Hacks','Free Templates'];
function listTab1(json) {
listOneTab(json, tabView1, "", false);
}
function listLatestPostsTab1(json) {
listOneTab(json, tabView1, "Latest Posts", true);
}
function listLatestCommentsTab1(json) {
listOneTab(json, tabView1, "Latest Comments", false);
}

// Activating calls!

// Latest Posts
cb.search( blog1, "posts", 1, 25, 'listLatestPostsTab1');

// Latest Comments
cb.search( blog1, "comments", 1, 25, 'listLatestCommentsTab1');

// Preferred Labels
for (var i=0; i < labels1.length; i++)
if (labels1[i]) cb.searchLabel(blog1, labels1[i], 'listTab1');

</script>
</b:includable>
</b:widget>

အထက္တြင္ ေဖာ္ျပထားေသာ Code မ်ားတြင္ ေအာက္ပါတို႔ကို ျပင္ဆင္ေပးရမည္။
<h2>Hoctro's Place</h2>
var nPost = 10;
var blog1 = "hoctro.blogspot.com";
var labels1 = ['JSON Hacks', 'Label Hacks','Free Templates'];

Hoctro's Place ေနရာတြင္ မိမိႏွစ္သက္ရာ Widget နာမည္ေပးႏိုင္သည္။
nPost မွာ မိမိေဖာ္ျပလိုေသာ ပို႔စ္ေခါင္းစဥ္ အေရအတြက္ ျဖစ္ပါသည္။
blog1 မွာ မိမိ၏ ဘေလာ့လိပ္စာအား သက္မွတ္ရန္ျဖစ္သည္။
label1 တြင္ မိမိ ေဖာ္ျပလိုေသာ Label မ်ားကို ထည့္သြင္းေၾကျငာေပးရမည္။