Sabtu, 19 Januari 2013

Modifikasi Blog-pager menjadi Page-number navigation

cara membuat halaman bernomor 123 di blogger 
 
Page Number, alias halaman bernomor pada blogger sementara ini belum tersedia. Untuk itu harus dilakukan modifikasi pada bagian blog-pager supaya menghasilkan tampilan yang menarik.

Berikut ini caranya:
1. login blogger lalu menuju editor HTML template
2. masukkan CSS berikut ini ( tempatkan di atas kode ]]></b:skin> )
/* Page-number-Nav */
.showpageArea{font-family:arial;font-size:11px;padding:6px 10px;text-align:right;font-weight:700}
.showpageNum a{color:#333; text-decoration:none;border:1px solid #999;margin:0 3px;padding:2px 5px}
.showpageNum a:hover{border:1px solid #ddd;}
.showpagePoint{margin:0 3px;padding:2px 5px}
.showpageOf{margin:0 8px 0 0;}
.showpage a{color:#333;text-decoration:none;border:1px solid #999;padding:2px 5px}
.showpage a:hover{border:1px solid #ddd}

3. berikutnya masukkan kode di bawah ini ( tempatkan di atas kode </body> )
<script type='text/javascript'>
var pageCount=2;
var displayPageNum=4;
var upPageWord =&#39;Previous&#39;;
var downPageWord =&#39;Next&#39;;
// <![CDATA[
var home_page_url=location.href;function showpageCount(json){var thisUrl=home_page_url;var htmlMap=new Array();var thisNum=1;var postNum=1;var itemCount=0;var fFlag=0;var eFlag=0;var html='';var upPageHtml='';var downPageHtml='';htmlMap[htmlMap.length]='/';postNum++;for(var i=pageCount-1,post;post=json.feed.entry[i];i=i+pageCount){var timestamp1=post.published.$t.substring(0,19)+post.published.$t.substring(23,29);timestamp=encodeURIComponent(timestamp1);var title=post.title.$t;if(thisUrl.indexOf(timestamp)!=-1){thisNum=postNum}postNum++;htmlMap[htmlMap.length]='/search?updated-max='+timestamp+'&;max-results='+pageCount}var banyaknomer=htmlMap.length;if(json.feed.entry.length%pageCount==0){var banyaknomer=htmlMap.length-1;postNum=postNum-1};for(var p=0;p<banyaknomer;p++){if(p>=(thisNum-displayPageNum-1)&&p<(thisNum+displayPageNum)){if(fFlag==0&&p==thisNum-2){if(thisNum==2){upPageHtml='<span class="showpage"><a href="/">'+upPageWord+'</a></span>'}else{upPageHtml='<span class="showpage"><a href="'+htmlMap[p]+'">'+upPageWord+'</a></span>'}fFlag++}if(p==(thisNum-1)){html+='<span class="showpagePoint">'+thisNum+'</span>'}else{if(p==0){html+='<span class="showpageNum"><a href="/">1</a></span>'}else{html+='<span class="showpageNum"><a href="'+htmlMap[p]+'">'+(p+1)+'</a></span>'}}if(eFlag==0&&p==thisNum){downPageHtml='<span class="showpage"> <a href="'+htmlMap[p]+'">'+downPageWord+'</a></span>';eFlag++}}}if(thisNum>1){html=''+upPageHtml+' '+html+' '}html='<div class="showpageArea"><span class="showpageOf"> Pages ('+(postNum-1)+')</span>'+html;if(thisNum<(postNum-1)){html+=downPageHtml}if(postNum==1)postNum++;html+='</div>';var pageArea=document.getElementsByName("pageArea");var blogPager=document.getElementById("blog-pager");if(postNum<=2){html=''}for(var p=0;p<pageArea.length;p++){pageArea[p].innerHTML=html}if(pageArea&&pageArea.length>0){html=''}if(blogPager){blogPager.innerHTML=html}}function showpageCount2(json){var thisUrl=home_page_url;var htmlMap=new Array();var isLablePage=thisUrl.indexOf("/search/label/")!=-1;var thisLable=isLablePage?thisUrl.substr(thisUrl.indexOf("/search/label/")+14,thisUrl.length):"";thisLable=thisLable.indexOf("?")!=-1?thisLable.substr(0,thisLable.indexOf("?")):thisLable;var thisNum=1;var postNum=1;var itemCount=0;var fFlag=0;var eFlag=0;var html='';var upPageHtml='';var downPageHtml='';var labelHtml='<span class="showpageNum"><a href="/search/label/'+thisLable+'?&;max-results='+pageCount+'">';var thisUrl=home_page_url;htmlMap[htmlMap.length]=labelHtml;postNum++;for(var i=pageCount-1,post;post=json.feed.entry[i];i=i+pageCount){var timestamp1=post.published.$t.substring(0,19)+post.published.$t.substring(23,29);timestamp=encodeURIComponent(timestamp1);var title=post.title.$t;if(thisUrl.indexOf(timestamp)!=-1){thisNum=postNum}if(title!='')postNum++;htmlMap[htmlMap.length]='/search/label/'+thisLable+'?updated-max='+timestamp+'&;max-results='+pageCount;itemCount++}var banyaknomer=htmlMap.length;if(json.feed.entry.length%pageCount==0){var banyaknomer=htmlMap.length-1;postNum=postNum-1};for(var p=0;p<banyaknomer;p++){if(p>=(thisNum-displayPageNum-1)&&p<(thisNum+displayPageNum)){if(fFlag==0&&p==thisNum-2){if(thisNum==2){upPageHtml=labelHtml+upPageWord+'</a></span>'}else{upPageHtml='<span class="showpage"><a href="'+htmlMap[p]+'">'+upPageWord+'</a></span>'}fFlag++}if(p==(thisNum-1)){html+='<span class="showpagePoint">'+thisNum+'</span>'}else{if(p==0){html=labelHtml+'1</a></span>'}else{html+='<span class="showpageNum"><a href="'+htmlMap[p]+'">'+(p+1)+'</a></span>'}}if(eFlag==0&&p==thisNum){downPageHtml='<span class="showpage"> <a href="'+htmlMap[p]+'">'+downPageWord+'</a></span>';eFlag++}}}if(thisNum>1){if(!isLablePage){html=''+upPageHtml+' '+html+' '}else{html=''+upPageHtml+' '+html+' '}}html='<div class="showpageArea"><span class="showpageOf"> Pages ('+(postNum-1)+')</span>'+html;if(thisNum<(postNum-1)){html+=downPageHtml}if(postNum==1)postNum++;html+='</div>';var pageArea=document.getElementsByName("pageArea");var blogPager=document.getElementById("blog-pager");if(postNum<=2){html=''}for(var p=0;p<pageArea.length;p++){pageArea[p].innerHTML=html}if(pageArea&&pageArea.length>0){html=''}if(blogPager){blogPager.innerHTML=html}}var thisUrl=home_page_url;if(thisUrl.indexOf("/search/label/")!=-1){if(thisUrl.indexOf("?updated-max")!=-1){var lblname1=thisUrl.substring(thisUrl.indexOf("/search/label/")+14,thisUrl.indexOf("?updated-max"))}else{var lblname1=thisUrl.substring(thisUrl.indexOf("/search/label/")+14,thisUrl.indexOf("?&max"))}}var home_page="/";if(thisUrl.indexOf("?q=")==-1&&thisUrl.indexOf(".html")==-1){if(thisUrl.indexOf("/search/label/")==-1){document.write('<script src="'+home_page+'feeds/posts/summary?alt=json-in-script&callback=showpageCount&max-results=99999" ><\/script>')}else{document.write('<script src="'+home_page+'feeds/posts/full/-/'+lblname1+'?alt=json-in-script&callback=showpageCount2&max-results=99999" ><\/script>')}}
// ]]>
</script>

4. cari kode  'data:label.url' lalu ganti dengan kode ini:
'data:label.url + &quot;?&amp;max-results=5&quot;'

5. dan yang terakhir klik simpan / save

Blog anda kini tampil lebih elegan berkat adanya Page-number-navigasi.


www.majalahsoftware.blogspot.com copypaste from : www.kaumcerdik.blogspot.com
Artikel Terkait :

0 komentar:

Posting Komentar

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes