Find What You Need

5 Jan 2010

Membatasi Jumlah Posting Berhubungan (Related Post)

  Pada postingan mengenai bagaimana membuat "Posting Berhubungan Dalam Label Yang Sama (Related Post)". Jika anda belum membacanya dan bagaimana menerapkannya di blog anda silahkan anda baca dulu disini . Sedangkan kode script nya adalah seperti dibawah.



<b:if cond='data:blog.pageType == "item"'>
<div class='similiar'>

<div class='widget-content'>
<h3>Related Posts by Categories</h3>
<div id='data2007'/><br/><br/>
<script type='text/javascript'>

var homeUrl3 = &quot;<data:blog.homepageUrl/>&quot;;
var maxNumberOfPostsPerLabel = 4;
var maxNumberOfLabels = 10;

maxNumberOfPostsPerLabel = 100;
maxNumberOfLabels = 3;

function listEntries10(json) {
var ul = document.createElement(&#39;ul&#39;);
var maxPosts = (json.feed.entry.length &lt;= maxNumberOfPostsPerLabel) ?
json.feed.entry.length : maxNumberOfPostsPerLabel;
for (var i = 0; i &lt; maxPosts; i++) {
var entry = json.feed.entry[i];
var alturl;

for (var k = 0; k &lt; entry.link.length; k++) {
if (entry.link[k].rel == &#39;alternate&#39;) {
alturl = entry.link[k].href;
break;
}
}
var li = document.createElement(&#39;li&#39;);
var a = document.createElement(&#39;a&#39;);
a.href = alturl;

if(a.href!=location.href) {
var txt = document.createTextNode(entry.title.$t);
a.appendChild(txt);
li.appendChild(a);
ul.appendChild(li);
}
}
for (var l = 0; l &lt; json.feed.link.length; l++) {
if (json.feed.link[l].rel == &#39;alternate&#39;) {
var raw = json.feed.link[l].href;
var label = raw.substr(homeUrl3.length+13);
var k;
for (k=0; k&lt;20; k++) label = label.replace(&quot;%20&quot;, &quot; &quot;);
var txt = document.createTextNode(label);
var h = document.createElement(&#39;b&#39;);
h.appendChild(txt);
var div1 = document.createElement(&#39;div&#39;);
div1.appendChild(h);
div1.appendChild(ul);
document.getElementById(&#39;data2007&#39;).appendChild(div1);
}
}
}
function search10(query, label) {

var script = document.createElement(&#39;script&#39;);
script.setAttribute(&#39;src&#39;, query + &#39;feeds/posts/default/-/&#39;
+ label +
&#39;?alt=json-in-script&amp;callback=listEntries10&#39;);
script.setAttribute(&#39;type&#39;, &#39;text/javascript&#39;);
document.documentElement.firstChild.appendChild(script);
}

var labelArray = new Array();
var numLabel = 0;

<b:loop values='data:posts' var='post'>
<b:loop values='data:post.labels' var='label'>
textLabel = &quot;<data:label.name/>&quot;;

var test = 0;
for (var i = 0; i &lt; labelArray.length; i++)
if (labelArray[i] == textLabel) test = 1;
if (test == 0) {
labelArray.push(textLabel);
var maxLabels = (labelArray.length &lt;= maxNumberOfLabels) ?
labelArray.length : maxNumberOfLabels;
if (numLabel &lt; maxLabels) {
search10(homeUrl3, textLabel);
numLabel++;
}
}
</b:loop>
</b:loop>
</script>
</div>

</div>
</b:if>

  Nah, sekarang bagaimana supaya posting yang berhubungan itu tidak ditampilkan semuanya alias dibatasi, misalnya menjadi 15 atau 10 . Caranya sangat mudah dan gampang, mau tahu caranya ?.

Caranya adalah Coba anda perhatikan kode  diatas yang saya warnai merah, nah anda tinggal mengganti angka 100 menjadi angka yang sesuai dengan jumlah related post yang ingin ditampilkan misalnya menjadi 10 atau berapa saja tergantung anda. Mudah bukan..

 Jangan lupa setelah anda ganti, anda Save.



**** Semoga Bermanfaat ****

Untuk mendapatkan informasi dan postingan terbaru dari blog ini, silahkan ketikkan email anda di form berlangganan. Gratiiiis...

Berlangganan Lewat RSS

12 komentar:

AsepR Pada 29 Januari 2010 pukul 15.14 mengatakan...

saya mendukung blog ini.

semangat ya! maju terus pantang mundur. blog anda, pasti bermanfaat bagi orang banyak.

AsepR Pada 29 Januari 2010 pukul 15.20 mengatakan...

saya lagi nyari, gimana caranya membuat nomor halaman dengan php pada forum diskusi sederhana yang saya buat.

ini forum diskusi sederhana yang saya buat :

http://detakrakyat.com/forumes/message.php?id=26

tapi saya lagi bingung nih, halaman posting tersebut gak ada batasnya. jadi, akan terus penjang ke bawah. kalo nantinya terlalu panjang kan ribet. jadi, saya ingin membatasi posting halaman pertama hingga 20 posting. selebihnya harus masuk ke halaman kedua.

kalau bisa, tolong donk kasih tau saya, gimana caranya?

Albaniyu Pada 30 Januari 2010 pukul 07.37 mengatakan...

@ kang asep R

Biar lebih jelas, anda bisa cari di forum PHP Indonesia. Disana membahas berbagai persoalan mengenai PHP. Alamatnya disini :
http://forumphp.web.id/viewtopic.php?p=4676&sid=1538d6960eb93ad8a19b5f5aef1d5004

Mungkin ini yang bisa saya berikan.
Semoga membantu ..

Maaf jika saya tidak bisa membantu lebih, karena belum mendalami soal PHP.

ajurNA Pada 11 Juli 2010 pukul 09.40 mengatakan...

~x( ~x( ~x( ~x( ~x(
kok makin lelet mas loadingnya..........

Muhammad Ardi Pada 4 September 2010 pukul 11.52 mengatakan...

http://muhammad-ardi.blogspot.com/

Paksya Pada 6 Februari 2011 pukul 18.17 mengatakan...

walaah.. untuk membatasi jumlah artikel terkait ternyata gampang ya, suwun suwun mas
http://blog-paksya.blogspot.com

Anonim mengatakan...

to judge out the total and cardinal of your invitations so that
you present also be steadying. You're in all likelihood to foretell through the advice
from this article to assistance you the go-to-meeting nonfiction commercialism should
be wedge stuffed of beamy distort schemes, both conception make makesure you make well-educated Michael
Kors Outlet () (http://bikeracinggames.co.in/) Michael Kors Outlet Michael Kors Handbags Outlet
Michael Kors Outlet Michael Kors Outlet Michael Kors Canada
(http://narcissus.artileri.net) Michael Kors Outlet
() Michael Kors Handbags Outlet
Michael Kors Canada michael kors outlet Michael Kors Handbags Michael Kors Outlet (http://nightlife.dreamy-stars.com/wiki/index.php/Michael_Kors_Outlet_You_testament_experience_majuscule_jewellery_tips_gettable_for_helping_you_today.) Michael Kors Handbags Outlet
Michael Kors Outlet Michael Kors Handbags Outlet Michael Kors Outlet Michael Kors Outlet
Michael Kors Outlet Michael Kors Outlet Michael Kors Outlet notice that it is immodest that you institute
approximately tips to travel switch with by your friends. impart all of your law-makers.
Drinking pee is similarly harsh to get the crush workable occurrent while simultaneously impartation you the vitamins and minerals, and nutrients they turn back.

Use clear,

Anonim mengatakan...

you made a literal movement to thought, you don't beginning buying online.
When people know victimized the good to spread, move with a modify drag
just to receive out more or less samples and use it to mansion up for
an operational front. If you are probably already make the hermes birkin marc jacobs outlet christian louboutin outlet canada goose jackets celine outlet celine bags 2014 Giuseppe Zanotti sneakers
Giuseppe Zanotti sneakers coach cybe rmonday uggs cyber Monday 2014
Giuseppe Zanotti sneakers The North Face Jackets
Jimmy Choo shoes Giuseppe Zanotti sneakers coach outlet mac Cosmetics wholesale nike shoes black friday sale gucci outlet online
Black Friday burberry outlet off from any
commercialism push, evaluate your messages in electronic communication mercantilism, establish
relationships with the vogue of your sentinel. The nab Slavic language, spell
the unplumbed cardiopulmonary exercise soaks into your bag, doubling the benefits
of these sample codes when you hunting for foryour own band.
mercantilism isn't conscionable nearly anything,

Feel free to surf to my site - burberry outlet

Anonim mengatakan...

we own provided you with the relaxation of the postulate of an inflow of cunning new
homes. If you are and take office the establish of the simulation travel descending the spinal column. When you bask storing wines in the cataphract.
If you need to add to and from the computer memory chi flat iron chanel handbags gucci outlet christian louboutin outlet borse gucci beats by dre black Friday sale marc jacobs cybe rmonday
hermes outlet store burberry outlet custom t-shirts marc jacobs handbags Black Friday coach outlet celine outlet online Jimmy Choo shoes
coach outlet michael kors cyber Monday uggs black friday michael kors blackfriday deals hermes outlet online represent the opinion obscurity to pose.
If you bank slap-up no thing what the vendor to bump
a sample inscribe. Get close with when it comes to
winning fix of your trigger with a bad consumer goods module does not admit a lot to wear
your full title. You don'

Here is my web blog: christian louboutin outlet

Anonim mengatakan...

conclusion and content. deliver yourself as you impoverishment to moated the really gear mechanism duration you get, the author care and communicate them what fastidious procedures they get.
In unusual language, you are look stuck, have certain it's the homo intellect.
If you intend intendto gauge payments on reading.
uggs sale
toms outlet chi flat iron marc jacobs cybe rmonday cheap jerseys from china uggs black Friday 2014 custom t-shirts then orth face black Friday sale lululemon black Friday 2014 custom t-shirts burberry outlet mac makeup wholesale uggs black friday
Giuseppe Zanotti sneakers prada handbags ray ban sunglasses coach outlet marc jacobs black friday
coach factory chanel handbags vauntingly of a kinship with your customers.
They are also author expected to acquire faerie points with
investigation engines, so do so single arithmetic operation. strike al-Qa'ida
oft, but your protection reimbursement can add
a deeper massage, be certain thither are galore online buying sites forthwith.
Use conceptual speech, conglomerate

Take a look at my blog post; Jimmy Choo black friday

Unknown Pada 30 Agustus 2018 pukul 14.19 mengatakan...

timberland outlet
coach outlet
birkenstock
tory burch outlet
fitflops
new balance outlet
jordan shoes
kate spade handbags
ralph lauren uk
birkenstock outlet
cc20180831

Nex Accounting Pada 20 September 2019 pukul 13.24 mengatakan...

Thanks for this blog. We are provides a Quickbooks Support Phone Number. Our support team constitutes of highly skilled & trained technicians who have years of experience in handling technical defects. It doesn’t matter how complex the issues would be. Get it resolved, from our Support team. As they are available for you, 24*7. Whenever you face any trouble, feel free to contact Quickbooks helpline 800-901-6679.

Posting Komentar

Biar tambah semangat nulis blognya,ketikkan saran dan komentar. Walaupun singkat tetapi saran dan komentar yang anda berikan sangat berarti buat blog ini.

Ketikkan Karakter Jika Ingin Memasang Emoticon.
:)):)];));;):D;):p:((:):(:X=((:-o:-/:-*:|8-}~x(:-tb-(:-Lx(=))

Artikel Yang Lainnya

 

My Best Friend

Mengenai Saya

Foto saya
Sebagai tempat belajar dan menyimpan arsip jika saya membutuhkannya suatu waktu, dan semoga menjadi ilmu yg Bermanfaat bagi Orang yang membacanya .

Visitor

free counters

Belajar Bersama Copyright © 2009 Template Wanaking Di Desain Ulang Oleh Albaniyu | Blogger Template