Make Related Post

Copy from Purple Moggy
Copied to NEWS
"If I copy your articles, I give the source to your site"


I first got the idea for this after seeing Hoctro's similar hack. Unfortunately his requires that you change all your post titles to have the same prefix for related articles. I wanted one that would show related posts based on labels. I also wanted to do something with the new JSON format. I also looked at some of the already made hacks from Beautiful Beta to figure out how to parse the JSON properly.

FYI, this probably won't work correctly if your labels use any reserved url characters, like question marks (?) or the slash character (/). I'm not url encoding anything here.

First of all, go to Template -> Edit HTML and paste the following into the page header:
<script type="text/javascript">
//<![CDATA[
var relatedTitles = new Array();
var relatedTitlesNum = 0;
var relatedUrls = new Array();
function related_results_labels(json) {
for (var i = 0; i < json.feed.entry.length; i++) {
var entry = json.feed.entry[i];
relatedTitles[relatedTitlesNum] = entry.title.$t;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
relatedUrls[relatedTitlesNum] = entry.link[k].href;
relatedTitlesNum++;
break;
}
}
}
}
function removeRelatedDuplicates() {
var tmp = new Array(0);
var tmp2 = new Array(0);
for(var i = 0; i < relatedUrls.length; i++) {
if(!contains(tmp, relatedUrls[i])) {
tmp.length += 1;
tmp[tmp.length - 1] = relatedUrls[i];
tmp2.length += 1;
tmp2[tmp2.length - 1] = relatedTitles[i];
}
}
relatedTitles = tmp2;
relatedUrls = tmp;
}
function contains(a, e) {
for(var j = 0; j < a.length; j++) if (a[j]==e) return true;
return false;
}
function printRelatedLabels() {
var r = Math.floor((relatedTitles.length - 1) * Math.random());
var i = 0;
document.write('<ul>');
while (i < relatedTitles.length && i < 20) {
document.write('<li><a href="' + relatedUrls[r] + '">' + relatedTitles[r] + '</a></li>');
if (r < relatedTitles.length - 1) {
r++;
} else {
r = 0;
}
i++;
}
document.write('</ul>');
}
//]]>
</script>

Save it, and then click the Expand Widget Template checkbox. Scroll down to the blog1 widget, and find the following:
        <b:if cond='data:post.labels'>
<data:postLabelsLabel/>
<b:loop values='data:post.labels' var='label'>
<a expr:href='data:label.url' rel='tag'><data:label.name/></a><b:if cond='data:label.isLast != "true"'>,</b:if>
</b:loop>
</b:if>

It'll probably be down in the post-footer-line section (whether that be line-1, -2, or -3)

Change that to:
        <b:if cond='data:post.labels'>
<data:postLabelsLabel/>
<b:loop values='data:post.labels' var='label'>
<a expr:href='data:label.url' rel='tag'><data:label.name/></a><b:if cond='data:label.isLast != "true"'>,</b:if>
<b:if cond='data:blog.pageType == "item"'>
<script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&amp;callback=related_results_labels&amp;max-results=10"' type='text/javascript'/>
</b:if>

</b:loop>
</b:if>

The 3 lines in bold are what I added ;)

Save it, and now go to Template -> Page Elements and add a new HTML/Javascript widget. I added mine underneath the main blog posts widget. You'll need to add it after (in the page) the above codebox for it to work correctly. Paste the following into it:
<script type="text/javascript">
removeRelatedDuplicates();
printRelatedLabels();
</script>

Now go back to Template -> Edit HTML, check the checkbox to expand the template code, and find the HTML/Javascript widget you just added. It'll look something like the following. Add the lines in bold:
<b:widget id='HTML13' locked='false' title='Related Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "item"'>
<!-- 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/>
</div>

<b:include name='quickedit'/>
</b:if>
</b:includable>
</b:widget>


There's a few numbers you can tweak to show more or less related posts. In the first codebox there's a part that says i < 20 and the 3rd codebox has a part that says max-results=10. You can play around with these numbers if you want. After playing around a little these numbers seem to give a good trade-off between the speed of page-load and the number of related posts displayed.

Earn Money with Google Adsense

Written by Herianto
Administrator of NEWS
"If you copy my articles, please copy this part too"


Google Adsense ImagesThis is tutorial for newbie. Just to the point.

1. You must have an e-mail. If you already have, skip this step. Or you haven't yet, you may read this articles : Make a Gmail and Make a Yahoo!Mail.

2. Make a blog or a site. Then build your blog. I suggest this articles : Create a Blog at Blogger, Create a Blog at Wordpress, and Optimize your Blog.

3. Sign up to Google Adsense. Just go to here, then click Sign Up and follow the instruction. Wait for 24-48 hours to be approved. Then check your mail.

Jika kamu ingin membaca artikel ini dalam bahasa Indonesia, klik di sini.

Create a Blog at Wordpress

Written by Herianto
Administrator of NEWS
"If you copy my articles, please copy this part too"


Make a Blog at Wordpress ImagesHere is another blog services beside Blogger from Google Product, lets read the point.

1. Go to Wordpress then click Sign Up. Or just go directly here.

2. Fill all form. Your user name will be use for log in to your wordpress account. Then click Next.

3. Fill all form. Then click Signup.

4. If success you will see Your Account Is Now Active!

5. Check your mail which you fill at second step. I don't have any idea yet about that.

Happy Explore there!

Jika kamu ingin membaca artikel ini dalam bahasa Indonesia, klik di sini.

Optimize your Blog

Written by Herianto
Administrator of NEWS
"If you copy my articles, please copy this part too"


What should you do after you create a blog? Maybe I like to give you some of term.

Publisher
This word is connected to articles. So, here you can post and publish much articles. Also the articles must be match with your blog theme. If you won't to get bored, I suggest that your blog theme is something you like most.

Template
Here you can build your blog physically. Just go to some of free template such : here, here, here, here, and here. To use that template, it probably can be upload at your blog account after you download the file. And the file extension is .XML for Blogger. Beside that, you can add more page element. Just practice by yourself there.

Visitor
Thats many way to gain visitors. You can observe your blog visitors by sign up to ExtremeTracking. Below I give you some terms and some ways to gain more visitor.
1. Authority, do link exchange. You can check your authority by sign up to Technorati.
2. SEO (Search Engine Optimization), write and publish much articles. You can check this by sign up to HitTail.
3. Leave your blog URL track to some of message boxes.
4. Join community sites. For examples : MyBlogLog, SpicyPage, Yahoo!Group, and more.
5. Tell your blog to friends via forums, e-mails, and chat services.

PR (Page Rank)
The mark is from 0 (zero) until 10 (ten). This can be your spirit to improve your blog. You can check your blog PR at prchecker.info and this site is own by Google. And Google do update PR every 3 (three) month.

Jika kamu ingin membaca artikel ini dalam bahasa Indonesia, klik di sini.

Create a Blog at Blogger

Written by Herianto
Administrator of NEWS
"If you copy my articles, please copy this part too"


Blogger Logo ImagesThis Blog services is one from many Google product. Before you create a blog, you must be have an e-mail. You may read my articles : Make a Gmail and Make a Yahoo!Mail. If you already have e-mail, just follow this steps.

1. Go to Blogger then click on Create Your Blog Now or you can go directly here.

2. Then you must have Google account, make Google account there or if you already have Google account such as Gmail, you just click on sign in there, then write your user name and password, click sign in.

3. Follow the three steps. And thats it, your blog has been created. *Tips : at the second step click on check availability to make sure that your URL isn't in used yet.

4. If you want to start posting for now one, click Start Posting. Or later you can click on Home.

Jika kamu ingin membaca artikel ini dalam bahasa Indonesia, klik di sini.

Make a Yahoo!Mail

Written by Herianto
Administrator of NEWS
"If you copy my articles, please copy this part too"


Yahoo!Mail ImagesOne from many e-mail services is Yahoo!Mail. And Yahoo!Mail is a product from Yahoo. Also Yahoo is a famous Internet services beside Google which have Gmail for an e-mail services. You may has both of that and here the steps.

1. Go to Yahoo then click on MAIL at the side or you just go directly Yahoo!Mail. Then click SIGN UP or you can go directly here.

2. Fill all three part form. Then click Create My Account.

3. And Congratulations. Click Continue for continue. Then activate your Yahoo!Mail at your Alternate e-mail you write down on the third part.

Jika kamu ingin membaca artikel ini dalam bahasa Indonesia, klik di sini.

Make a Gmail

Written by Herianto
Administrator of NEWS
"If you copy my articles, please copy this part too"


Gmail ImagesOne from many of Google product is Gmail which refers to Google Mail. This is an e-mail services. Most of Internet users must be know e-mail. But, according to my experience, Indonesian peoples doesn't know that well. Also some of them haven't an e-mail yet. So, here the steps.

1. Go to Google then click on MAIL on the top or you just go directly Gmail. Then click SIGN UP or you can go directly to LINK.

2. Fill all eleven forms. Then click I accept. Create my account. *Tips : Click on check for availability! at the third form for make sure that your user name isn't used yet.

3. Click I'm ready - show me my account on the top right. Then verify your e-mail at your other e-mail which you write on the ninth form.

Kamu dapat membaca artikel ini dalam bahasa Indonesia DI SINI.

Happy 2008 New Year from TEIRANHO

Hello all, first i like to say happy new year to you. By this article, I want to announce that I change my blog theme from Computers be NEWS. Wish by this, the goodness will belong with us. May I congrats to myself :). May I say thanks to all of you whose always support me, especially to Arya Kusuma. He teach me about blogging and we live together in boarding house Yogyakarta. Until now, I has many blogs because of his support. Here is my blogs :