Custom Search
Ads by VADpay advertising

Google Adsense for Vietnames Headline Animator

Showing posts with label Hacks. Show all posts
Showing posts with label Hacks. Show all posts

Thursday, September 25, 2008

2 methods to display "Related Posts"

I would like to display "Related Posts" for all labels of my blog. Therefore, I have search from internet, and there are two interesting methods made by PurpleMoggy and Hoctro. Now I am using both of them for my two blogs: one is here, and the other is in http://easyadsense4vn.blogspot.com/. They work well. So I should recommend them to those who did not know about this widget.

First is the method of Hoctro:

Before you could install this hack:

To make this hack working, make sure you turn your "feeds" on. The setting is set to "on" in your blog by default.

Make sure your feed settings look like this (short or full):



and not like this:



Also, make sure in "Settings"->"Archiving", "Enable Post Pages?" is set to "Yes"




To install this hack, first follow the instructions from this article Hacking Technique: How To Modify and add Widget to the Template, in particular section B.4.

Then, cut this code below and paste it in between any two "b:widget" tags, save the template, and you're done!


<b:widget id='Blog3' locked='false' title='Blog Posts' type='Blog'>
<b:includable id='comments' var='post'>
</b:includable>
<b:includable id='postQuickEdit' var='post'>
</b:includable>
<b:includable id='main'>
<!-- *****************http://hoctro.blogspot.com*****Sep,2008********** -->
<!-- ***Related Articles by Labels Written by Hoctro- Take Three******* -->
<!--<b:if cond='data:blog.pageType == "item"'>-->
<div class='widget-content'>
<h3>Related Posts</h3>
<div id='data2007'/><br/><br/>
<div id='hoctro'>Widget by <u><a href='http://hoctro.blogspot.com'>Hoctro</a>

</u></div>
<script type='text/javascript'>


// Incorporating modified by Jackbook to the next line, thank you very much.
var homeUrl3 = "<data:blog.homepageUrl />";
var maxNumberOfPostsPerLabel = 4;
var maxNumberOfLabels = 10;

<b:if cond='data:blog.pageType == "item"'>
maxNumberOfPostsPerLabel = 100;
</b:if>
<b:if cond='data:blog.pageType == "item"'>
maxNumberOfLabels = 3;
</b:if>


function listEntries10(json) {
var ul = document.createElement('ul');
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 == 'alternate') {
alturl = entry.link[k].href;
break;
}
}
var li = document.createElement('li');
var a = document.createElement('a');
a.href = alturl;

// Adding an if statement to exclude current post. Addition from Jackbook.com. Thank you
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 == 'alternate') {
var raw = json.feed.link[l].href;
var div1 = document.createElement('div');
div1.appendChild(ul);
document.getElementById('data2007').appendChild(div1);
}
}
}

function search10(query, label) {

var script = document.createElement('script');
script.setAttribute('src', query + 'feeds/posts/default/-/'
+ encodeURIComponent(label) +
'?alt=json-in-script&amp;callback=listEntries10');
script.setAttribute('type', 'text/javascript');
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 = "<data:label.name/>";

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>
<!--</b:if>-->
</b:includable>
<b:includable id='backlinkDeleteIcon' var='backlink'>
</b:includable>
<b:includable id='feedLinksBody' var='links'>
</b:includable>
<b:includable id='backlinks' var='post'>
</b:includable>
<b:includable id='status-message'>
</b:includable>
<b:includable id='feedLinks'>
</b:includable>
<b:includable id='nextprev'>
</b:includable>
<b:includable id='commentDeleteIcon' var='comment'>
</b:includable>
<b:includable id='post' var='post'>
</b:includable>
</b:widget>




Important features & notes:

1. To set the maximum of headlines per label, change the number on this line (right now it's 4.)

var maxNumberOfPostsPerLabel = 4;


2. To set the maximum of labels, change the number on this line (right now it's 10.)

var maxNumberOfLabels = 10;

My experience using Labels is that you should try to minimize down each post to just two labels only, then in conjunction with the maxNumberOfPostsPerLabel you will get your list to look more effective.

3. To show the widget only on item page.

If you do not want to have the widget on the front page, since you might have a front page with many posts, then change this line (in bold) at around the front of the widget:

<!-- *****************http://hoctro.blogspot.com*****Sep,2008********** -->
<!-- ***Related Articles by Labels Written by Hoctro- Take Three******* -->
<!--<b:if cond='data:blog.pageType == "item"'>-->


to become:

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

and also at about two-third of the widget, from:

<!--</b:if>-->

to,

</b:if>

4. To limit the space of the widget

Sometimes there might be lots of headlines and taking lots of spaces, but in the mean time you want to list as many related articles as possible. I recomment you to turn the widget into a box, a CSS feature I recently used in the "TOC Widget".

To do so, look for this line (located at the front of the widget):

<div id='data2007'/><br/><br/>

then add CSS styles to it:

<div id='data2007' style='height:200px;overflow:auto;border:1px solid brown'/><br/><br/>

The styles I use are the height of the widget (200px) and to turn it into overflow mode so the long headlines don't get lost at the end of the box. I also draw a thin solid brown border. The are just examples of what you could do.

Now I show you the method of PurpleMoggy:

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.

I wish you can do it successfully.
-->Read the full post...

Tuesday, September 23, 2008

How to display "Popular Pages Today" and "Most Viewed Posts"?

Together with the post How to display "Recent Comments" for your blog just in 1 minute?, in this post I shall show you how to show your "Most Viewed Posts" (without days) and your "Popular Pages Today". These are important for your visitors to regconize the most interesting contents in your Blog. Thanks AnhVo for writing the code for "Most Viewed Posts".

First, to show your "Most Viewed Posts", you add the following code at anywhere you would like to display it:

<script type="text/javascript">
start_views_num = 500;
limit = 7;
</script>
<script src="http://www33.websamba.com/anhvosite/blogger/js/topviews222.js" type="text/javascript"></script>

Note that, you should replace two parameters start_views_num and limit by the least viewed number of posts and the limited number of posts you would like to display, respectively.

Now I shall show you how to display "Popular Pages Today", using FEEDJIT. First, you visit the homepage of FEEDJIT. There are 4 interesting widgets served by FEEDJIT: LIVE TRAFFIC FEED, LIVE TRAFFIC MAP, LIVE RECOMMENDED READING, and LIVE PAGE POPULARITY. Here we are interested in showing "Popular Pages Today", so I recommend you using the widget LIVE PAGE POPULARITY. You just need to click into ADD IT!, one new window appears, you should copy the code and paste in your HTML source at anywhere you would like to display it!

Moreover, if you are using Blogspot or TypePad, it is easier for you to add this widget directly. You are still standing in this new Window, you just choose Blogger or TypePad, choose your blog, choose the title to displace, and finally, you click into ADD WIDGET. You should save your setting, and now you may return to your homepage to see your "Popular Pages Today".

I hope this post can help you avoiding a headache!

-->Read the full post...

Wednesday, September 10, 2008

How to display "Recent Comments" for your blog just in 1 minute?

I think that there are many people have the same problem as me in replying the comments in our blog. Your responsibility in replying comments is one of the tips to increase your Blog traffic. However sometime we don't know that there are some comments about one of our old posts. One way to know is that, you can set in the Setting tag for the Comments the Comment Notification Email. Once you have a new comment, the system inform you automatically via this email. However, if you have many comments the your mail-box will full!
According to me, if we can display in our blog the function: Show recent comments then it is easier to control, because I am sure that you surf your blog every day!
How to do it? There are many ways to fix this problem, of course. However the simplest, fastest way as I have ever known coming from Blogger-Templates. You can come there to fill out your information, click into Apply --> Add Widget into my Blog, a new window open, you Select a blog, choose the Title, Add Widget. It takes you about 1 minute to finish!
Now you can come here to show your Recent Comments!
Vietnameses can visit here to read!
-->Read the full post...

Tuesday, September 9, 2008

Trick to Add AdSense, AdBrite and Other JavaScript Ad Code Directly to Blogger HTML Template

I have at least once a problem with adding the code from Google AdSense, AdBrite, Amazon Associtates,...However I can find the solution when I read the post of Mydigitallife. Following I shall share to you this post. Vietnameses can visit here to read.

Note: In my post, I show you how to translate a Html code to a Xhtml code using a tool from Eblogtemplates: Blogger Ad Code Converter. Thanks for a useful tool!!!

Advanced users of Blogger.com service may have tried to insert and put Google AdSense ad code which is actually a Java script directly into the blog pages by manually editing the XML-based template HTML coding interface. Actually, it’s possible add any ad code by using HTML/JavaScript page element within the Blogger new XML template system, but the place where you can place the new block is rather limited, i.e. above or below the post body, header, footer, within sidebar or between blog posts. In case you want to put the ads inside the post, or align the ads to float and wrap around the text, or just within the single individual article content view, you will have to edit directly the HTML coding of Blogger template.

If you try to insert any Google AdSense, AdBrite, AdEngage and any other JavaScript based ad code, or client-side components such as counter, tracker, form, snippet, effect, date and time, etc which is JavaScript based, the following error message may be returned when saving ore previewing:

Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly. XML error message: The processing instruction target matching “[xX][mM][lL]” is not allowed.

or

Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The reference to entity “zs” must end with the ‘;’ delimiter.

and many other different XML error message.

The problem is caused by incorrect dynamic interpretation of Blogger XML template when it generates the HTML webpage for the blog page that is requested, probably due to the fact that the AdSense ad code or other code is not a valid XML, coupled with the fact that some ASCII characters have special meaning and reserved functions, confusing Blogger blogging engine.

The resolution to the JavaScript based coding does not work in Blogger HTML template error can be solved by replacing special characters or symbols in the script to HTML code. Check out the list below for which ASCII characters that need to be replaced with their corresponding HTML code. Using HTML code will ensure that Blogger render the character correctly when serving the page to the viewer.

< --> &lt;

> --> &gt;

Above two is enough to make Google AdSense works in Blogger template. For other scripts, such as AdBrite ad code, you will need to replace more characters such as those listed below.

& --> &amp;

” --> &quot;

For example, a Google AdSense code should become looks similar to code below:

<script type="text/javascript"><!--
google_ad_client = "pub-XXXXXXXXXXXXXXX";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "000000";
google_color_text = "000000";
google_color_url = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

While an AdBrite ad code will became the similar code to the below:

&lt;script type="text/javascript"&gt;

var AdBrite_Title_Color = '0000FF';

var AdBrite_Text_Color = '000000';

var AdBrite_Background_Color = 'FFFFFF';

var AdBrite_Border_Color = 'FFFFFF';

&lt;/script&gt;


&lt;script src="http://ads.adbrite.com/mb/text_group.php?sid=303771&amp;zs=3330305f323530" type="text/javascript"&gt;&lt;/script&gt;

<div><a target="_top" href="http://www.adbrite.com/mb/commerce/purchase_form.php?opid=303771&amp;afsid=1" style="font-weight:bold;font-family:Arial;font-size:13px;">Your Ad Here</a></div>

Simply use the text editor to parse the code and then replace the characters. Don’t worry about violating AdSense TOS or other terms and conditions, as once the blog’s web pages are rendered and presented to the viewers and visitors, the code will be exactly same as the original code before any replacement!

Now I shall show you how to translate a Html code into a Xhtml code using Blogger Ad Code Converter. You can get this tool for free by clicking here.

What you need to do is that, register for AdSense, AdBrite, Chitika eMinimalls,... and get the Ad Code from there. You paste that code into Blogger Ad Code Converter. You can get your Xhtml code in a moment. Highlight All it, and paste it into your Html source where you would like. I'm sure that it works well!

Please see the following picture:

I wish you can solve your problem as what I have done!

-->Read the full post...

Sunday, September 7, 2008

How to add Bookmarks to your Blogger blog?

In this post I shall show you how to add the Bookmark button like this
into your Blogger blog.

Adding the Bookmark button is one of the ways to increase the traffic of your blog. This post combines together with the other posts about this problem. You can see here and here for 20 tips for increasing the traffic of your blog. For Vietnameses, you can visit here to read it.

The method what I am showing you here produces a Bookmark button appearing in the same line as the title of each post.

Steps to make it:

1. Open the page Addthis.com, register an account there, open your email to activate your account, after that return to the page Addthis.com to login for using.

2. Click into the tag GET THE WIDGET! or click in to the page: http://www.addthis.com/web-button-select.html
+ Which kind of widget?:Let choose Bookmarking Widget.

+ Which widget? : Choose the size of the Bookmark you prefer. For me I would like to choose small buttons.

+
Where? Where do you want to put the widget? Chooe on a Blog.

+
Blogging Platform: Choose Blogger.

3. Click into the tag Get Your Free Widget. You will see the Code of the widget. You should copy the code in New Drop-down.

Now you can paste that code into your Html at any where you would like.

Following I shall show you where should you paste the code to obtain a Bookmark button in the same line as the title of each post.

4. Go to Layout---> Edit Html. For safety you should save the current template (Download Full Template) .

5. Tick into Expand Widget Templates to view the full code.

6. Search for <div class='post hentry uncustomized-post-template'> and add the following code at the right above of this line, and now the code looks as follow:

<!-- AddThis Bookmark Post Dropdown BEGIN -->
<div style='float:right; margin:2px 0 2px 5px;'>
<script type='text/javascript'>
addthis_url='<data:post.url/>'; addthis_title='<data:post.title/>'; addthis_pub='anhvo';</script>
<script src='http://s7.addthis.com/js/addthis_widget.php?v=12'
type='text/javascript'></script></div>

<!-- AddThis Bookmark Post Dropdown END -->

<div class='post hentry uncustomized-post-template'&gt;

The red code is what you get from Addthis.com as above (you should remember to replace it here by your code!!!). You just need to add the code style='float:right; margin:2px 0 2px 5px;' inside the tag <div>. Now you can save the template and see the result.

Note: You can put the Bookmark button at the end of your post. Please try to do it by yourself for improving your technique in blogger!!!
-->Read the full post...

Saturday, September 6, 2008

How To Add The Blogger “Read More” Expandable Posts Link Keeping The Representative Picture

In the previous post, I have introduced a method to add "Read more" expandble link in your blog. All the posts change automatically to this form. However, have you regconized that, when your post has a representative picture for it, it does not appear in the home page before the icon "Read more...."? In this post, I shall show you how to display the representative picture of the post together with "Read more".

Actually I translate this post from a Vietnamese Website (by Anhvo). Vietnameses can visit this Website to read for more details!

Note: If you have used the method in the previous post, you must remove the code that you have replaced for <data:post.body/>. You should go back to the previous post to look for an exactly code for removing.

For those whose try the first time with this new method, you can follow the following steps:

1. Open the tag Edit HTML, click into Expand widget templates, find <data:post.body/> in the code (use Ctrl+F) and replace it by the following code:


<b:if cond='data:blog.pageType != &quot;item&quot;'>
<div expr:id='&quot;summary&quot; + data:post.id'><data:post.body/></div>
<script type='text/javascript'>createSummaryAndThumb(&quot;summary<data:post.id/>&quot;);</script>
<span class='rmlink' style='float:right'><a expr:href='data:post.url'>--&gt; Read more...</a></span>
</b:if>
<b:if cond='data:blog.pageType == &quot;item&quot;'><data:post.body/></b:if>


2. Add the following code in the HEAD (<head> .... </head>) of the template:


<script type='text/javascript'>
summary_noimg = 430;
summary_img = 340;
img_thumb_height = 100;
img_thumb_width = 120;

</script>
<script src='http://vietwebguide2.googlepages.com/summary-post-v20-test.js' type='text/javascript'/>


Note that, the red codes have the meanings as follow:

summary_noimg is the number of letters in the described part for posts having no representative picture.

summary_img
is the number of letters in the described part for posts having representative picture.

img_thumb_height is the height of the representative picture (pixel).

img_thumb_width is the width of the representative picture (pixel).


Now you can try this method with your blog.

-->Read the full post...

Friday, September 5, 2008

Showing Your Contents By Blogger's Labels


By Hoctro.

Vietnameses can visit here!

Important Update:
Labels now suppose to support unicode label. Please give it a try.

I have a pretty long "grown-up Xmas" list, and in terms of Blogging hacks, one of my wish is to find time to continue hacking with the new JSON format :-))) (Just kidding).

After struggling for two weeks, here is the first of many more JSON hackings to come: a "Contents by Category" widget.

This is what it looks like on the side bar:

And with a simple drag-n-drop (that's how I love the new Blogger!) here it is on the main column:
Of course with some simple CSS twists you could make it looks more fancier, if you wish.

To install, first follow the instructions from this article Hacking Technique: How To Modify a Template, in particular section B.4.

Then, cut this code below and paste it in between any two "b:widget" tags, save the template, and you're done with the installing part.

<b:widget id='HTML50' locked='false' title='Contents By Category' type='HTML'>
<b:includable id='main'>
<!-- *****************http://hoctro.blogspot.com*****Dec,2006****************** -->
<!-- <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'>
<div id='data2006'/>
<script type='text/javascript'>

var homeUrl2 = "hoctro.blogspot.com";
var labels = ["Killer Hacks","Simple Hacks",
"3 Column Templates", "Ajax Hacks","Custom Widgets", "Hacking Techniques"];


// Given a json label search, this function return the decoded label.
function getLabelFromURL(json) {
for (var l = 0; l &lt; json.feed.link.length; l++) {
if (json.feed.link[l].rel == 'alternate') {
var raw = json.feed.link[l].href;
// The next two lines are borrowed from Ramani's Neo Template
// code. Thanks Ramani!
var label = raw.substr(raw.lastIndexOf('/')+1);
return decodeURIComponent(label);
}
}
}

function listEntries2(json) {
var ul = document.createElement('ul');

for (var i = 0; i &lt; json.feed.entry.length; i++) {
var entry = json.feed.entry[i];
var alturl;

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

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 == 'alternate') {
var raw = json.feed.link[l].href;
var label = raw.substr(homeUrl2.length+21);

var label = getLabelFromURL(json);
var txt = document.createTextNode(label);
var h = document.createElement('h4');
h.appendChild(txt);
var div1 = document.createElement('div');
div1.appendChild(h);
div1.appendChild(ul);
document.getElementById('data2006').appendChild(div1);
}
}
}

function search2(query, label) {

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

for (var i=0; i &lt; labels.length; i++)
if (labels[i])search2(homeUrl2, labels[i]);
</script>
</div>

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


Now, those settings in bold are for my blog! So, if you would like to do some free advertisements for me, then I wouldn't mind :) But I guess not.

To change the code to your blog, along with the listing of your featured labels/categories, modify the bold texts below in the code:

var homeUrl2 = "hoctro.blogspot.com";
var labels = ["Killer Hacks","Simple Hacks",
"3 Column Templates", "Ajax Hacks","Custom Widgets", "Hacking Techniques"];

The second line is actually an array, separated by commas, and inside the double quotes. Replace those with yours, and feel free to add more if you like.

Until next time,

Hoctro
12/13/06
Thanks.

***

Update:

1/17/07: Fixed bug of labels not having the right child posts. A new div will make sure the label header and its posts stays in one place.

var div1 = document.createElement('div');
div1.appendChild(h);
div1.appendChild(ul);
document.getElementById('data2007').appendChild(div1);

-->Read the full post...

Thursday, September 4, 2008

How to Set up Google Custom Search for Your Website and Make Money?

By: Doshdosh.

Vietnameses can visit here.

Visitors often visit websites and perform keyword searches in order to find the information they require. One way to make money from this often repeated user action is to display targeted advertisements on your search results pages.

Ideally, you want to monetize while adding value for your visitors and a means to achieve this aim is to use Google’s Adsense for Search, which places text-based ads next to your search results.

I’ve inserted a Google Custom Search engine on Dosh Dosh a few months ago and I thought it’ll be helpful to share the process of setting up a Google Custom Search for your own site, in order to generate some extra income.

What is a Google Custom Search Engine?

Simply put, Google Custom Search Engine is a tool which allows visitors to search your website by using Google’s core search technology. This enables you to list search results according to the sites and pages you specify. According to Google, the Custom Search Engine also allows you to:

  • Apply your Website’s look and feel to the search results page.

  • Provide search refinements within results pages to make it easier for searchers to find the information they’re looking for.

  • Make money from your Custom Search Engine by participating in Google’s AdSense program.

There are two main ways for visitors to experience your Custom Search Engine. One way is to direct them to a Google-hosted results page when they type in a search query and the second way is to integrate it by hosting the search results on a page within your website.

Example of an Integrated Google Custom Search Engine

Currently I’m using Google’s Custom Search Engine for Dosh Dosh and you can see it on the top right hand corner of every page. Typing in a search query and clicking ‘search‘ will bring you to a search results page on the left, where the content section is currently located.

Here is an example of a search for ‘make money blogging‘. Note that the Adsense ads appear at the top (this is changeable) and the search results show up below it.

Google Custom Search Results for Dosh Dosh

Why I am Using Google’s Custom Search Engine

I am using Google custom search instead of the internal Wordpress search function because I feel that Google’s search results are far more relevant and precise. I also choose to use Custom Search because it allows me to make money from Adsense for Search, which allows you to monetize your search results pages with ads.

A look at my Adsense stats shows me that I’ve earned approximately $20 in this month. It’s not a lot of money at all but it is still an additional source of income, particularly if you are already running Adsense on your site.

Like the traditional Adsense units, how much you earn might vary depending on the ad placement and traffic levels. If you like Google’s search results but don’t feel the need to monetize, set up the custom search engine without advertisements.

How to Set up Google’s Custom Search for Your Site

While writing this article, I found out that SEOmoz had a similar post on how to perform the same steps. I’ve decided to use my own commentary instead, as some readers have been asking me how I set up the google search box on Dosh Dosh.

There have also been some changes (additional features) within Google’s Custom Search function so this will be a more current post on this topic.

Here are the exact steps needed to successfully set up and integrate Google’s custom search engine into your website. This will teach you how to make the search results show up within a designated page on your site.

1. Create a Webpage for Custom Search

Start first by creating a web page on your domain for the search results page. If you are on Wordpress, simply click on ‘Write’ and then select ‘Write Page’. Name the page by using ‘Search results’ or something similar as the Page title.

Leave the text box blank and publish or save the page. Note down the URL for the webpage as you will need to use it later.

Google Custom Search Wordpress Write Page


2. Create Your Custom Search Engine

Visit the Google Custom Search Engine homepage and click on the ‘create a custom search engine‘ tab. After which, fill in the name of your search engine, along with the keywords. Be sure to select the ‘Only sites I select‘ option and then list your site URL in the Sites to Search box.

Also remember to select ‘Show Ads on results pages‘ if you intend to run ads.


Google Custom Search Homepage


Google Custom Search Engine 1


Google Custom Search 2


After creating your custom search engine, you’ll be asked to test it by entering some keywords. Type in some keywords related to your site to see the results.


Google Custom Search 3


3. Determine the Look and Feel for Your Search Engine

After you’ve created your search engine, go to your control panel and click on the Look and Feel link. This is where you will able to determine the branding style for your search box, along with the style of the search results page.

Choose the right colors so that the results pages fit your overall design.

Google Custom Search CPanel Look n Feel 1


Google Custom Search Cpanel Look n Feel 2

You can also choose to add a logo to the Google hosted results page but in this case, it won’t be necessary as you are hosting the search results on your own site.

4. Set up Adsense for Search

If you want to make money from your custom search engine, you’ll have to set up Adsense for search by clicking on the ‘Make Money‘ navigational link and connecting custom search with your Google Adsense account.

If you already have an Adsense account, simply check the appropriate box and then type in the email, zip code, phone and location details associated with it.

Google Custom Search Engine Adsense Setup
After doing this your custom search engine profile will be connected to your Adsense account. You can then set up a custom channel to track the amount of searches and money you are earning from it.

Simply do this by typing in a name for your custom channel. For example, I’ve used ‘Dosh Dosh Custom Search‘ as my channel name. This means that the same name will show up in my Adsense Dashboard reports as well.

Google Custom Search Control Panel Money
5. Insert the Code on Your Blog

After you’ve completed the above steps, its time to insert the code on your blog. Go to the ‘Code‘ section of the control panel and select the iframe option.

The new Overlay option will allow the search results to show up in a nifty Ajax-style overlay but unfortunately only the first 8 search results are displayed and you cannot make money through Adsense for Search.

Only consider the overlay option if you are not planning to run ads. After choosing the hosting option, specify the search results details by inserting the URL where you want the results to appear. This would be the page you’ve created in step one.

Google Custom Search CPanel Code 1
Then scroll down to the second half of the page to grab the search box code. Take the first code you see and place it where you want your search box to appear. After which, copy the search results code in the lower frame and place it where you want the search results to appear.

Which means you’ll have to paste it on the new page you’ve created.

Google Custom Search Cpanel Code 2

For Wordpress blogs, simply open up your new page, insert the code in the empty text box and publish.

Google Custom Search Wordpress Page Insert Code

And That’s All You Need to Do

After completing all the steps above, you should have Google Custom Search set up perfectly for your website. One possible drawback I think of when using ads on the search results pages is that users will click away from your website.

I don’t think this is really that big a problem because users who actively use your website to search for a specific items are people that are interested in your opinion or content. I would believe that these visitors would return to your site eventually.

An easy solution to this would be to run no ads at all. The choice is yours.

-->Read the full post...

Wednesday, September 3, 2008

Adding the contact form to your blogspot with Kontactr!

In the previous post I have shown you how to add a contact box in to our blogspot using Contactify. We can also use Kontactr to do it.

I have tried both methods, and I regconize that the code (to add in html of your blog) of Kontactr is a little longer :-D, and if we you use Kontactr, the contact form will be simpler (has no choices for Agreement), so if the visitors would like to cancel their massages to the blog author then it is impossible.

Of course you can choose which method that is more suitable to you.

Here are details (posted by Bloganol).

This contact form is brought to you by Kontactr.People can contact you without Leaving the Page . when the People leave a message in the contact form you will receive it in the form of email. Using Kontactr is Free. You can learn more by reading FAQs. Check the Snapshot in the following picture:

-->Read the full post...

How to add the contact form to your blogspot? - Guidances with pictures

Almost websites of companies have the contact form for convenience to contact, help, ask, explain, etc. There are many ways to do it, with Kontactr, with Contactify,... In this post, I shall show you how to add a contact box in the blogspot using Contactify.

Actually this technique is very basic, however I hope it can be useful for beginning bloggers.

For Vietnamese beginning bloggers, you can visit here to read in Vietnamese.

First you have to visit the page www.contactify.com to register an account with your detail contact email and password. Of course you have to confirm the code from that website. Then you open your email account and activate your account with Contactify.com.

You can see the following picture to see more clearly:
After finishing this step you get a link of the form: http://www.contactify.com/4ea1e. Now you just need to add the code of the form <a href="http://www.contactify.com/4ea1e" target="_blank"> Contact </a> into the html of your blog. (Go Layout-->Edit Html and paste the above code in a suitable position in your htlm).

However, if you would like to embed your contact form into the source code, you use the last number in the above link (it is called link number, for example, the link number in the above link is 4ea1e). Now in the page www.contactify.com let choose the tag embed, enter your link number, and press the tag widgetbox. You can see n the following picture:
Now in the box Widget setting you enter your Name to contact, change the width, height, check your link number, enter your massage in the Custom message box. You need not fill any thing in the CSS box. Finally, you press Get Widget.

Now you copy the code and paste in your html as above.
If this post is interesting and you would like to update new articles automatically, please visit RSS to subscribe your email. Thanks for your attention!
-->Read the full post...

Add a Cool Slideshow of Picasa Photos to Your Blog

By David.

For Vietnameses, you can visit here to read in Vietnamese!

Picasa is a free photo management product by Google that I actually use for all my photos. The software organizes and can adjust your photo albums on your computer and then easily uploads them to your Picasa account. I love the ability to quickly upload pictures from my trips, etc and just send the url to my friends and family.

So if you already have a Picasa account and have pictures you’d like to include on your blog, you should check out this widget. If you don’t have Picasa yet, I highly recommend you download it for free by clicking on the link below.

After you select the photo album and settings you want to use, it gives you some code to paste into your site. You can either paste it into your post or add it to your sidebar by creating an html/javascript widget. Then just paste the code into the widget and save.

Here’s a screenshot of the widget being setup:
Notice how easy the setup process is. It provides the code to paste into your blog and then you’ll have a flash slideshow rotating through all your photos! Pretty cool. I was going to include a working demo but once you login to your account and start building a slideshow, it shows you real-time how it works. It’s worth checking out….enjoy!
-->Read the full post...

Tuesday, September 2, 2008

How To Add The Blogger “Read More” Expandable Posts Link - One more method

In the previous post, I have introduced a method to add "Read more" into our blog, and it works well. However, there are some inconveniences with this method:

First, for each posting we have to add the code <span class="fullpost"> and </span>. It is boring.

Moreover, for those whose have posted many articles without "Read more", you have to edit all posted articles to add
<span class="fullpost"> and </span> in your posts.

Following I shall introduce to bloggers a new method, it works automatically for all old and new posts. For Vietnameses, you can visit here to read in Vietnamese.

If you have ever used any methods for "Read more", please remove their code out of your html source.

Now we begin to add the code in our html source.

1. Go to Edit Html,
click to Download full template for safety.

2.
Choose Expand Widget Tempate.

3. Press F2 to looking for <data:post.body/> and replace it by the following code:


<b:if cond='data:blog.pageType != &quot;item&quot;'>
<div expr:id='&quot;summary&quot; + data:post.id'/>
<script type='text/javascript'>
var blogID = &quot;937920098338306331&quot;;
function retriveSummaryPost<data:post.id/>(json){document.getElementById(&quot;summary<data:post.id/>&quot;).innerHTML
= json.entry.summary.$t + &quot;...&quot;}

function createSummaryPost<data:post.id/>(POSTID){ var script =
document.createElement(&quot;script&quot;);
script.src = &quot;http://www.blogger.com/feeds/&quot;+blogID+&quot;/posts/summary/&quot;+POSTID+&quot;?alt=json-in-script&amp;callback=retriveSummaryPost<data:post.id/>&quot;;
script.type = &quot;text/javascript&quot;; document.getElementsByTagName(&#39;head&#39;)[0].appendChild(script);
}
</script>
<script type='text/javascript'>
createSummaryPost<data:post.id/>(&quot;<data:post.id/>&quot;);
</script>
<span class='rmlink' style='float:right'><a expr:href='data:post.url'>--&gt;Read more...</a></span>
</b:if>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div id='post_body'><data:post.body/></div>
</b:if>


Please replace the number 937920098338306331 by your blogID. You can read here to know how to get the blogID.

-->Read the full post...

How To Add The Blogger “Read More” Expandable Posts Link

This is a pretty popular Blogger hack that lots of people have asked me about. Instead of answering to each email individually, I thought it would make more sense to write an article about it.

With this hack, you can choose to display a select amount of text from the beginning of each post as a teaser instead of showing the entire post on the front page of your blog. Then when people want to read the rest of the post, they can click a “read more” link to see the full post. This is very handy if you have lots of long articles all on one page. (Note that you’ll need to have post pages enabled in order to make this feature work.)

Step #1 - Update Your Template Code

First you need to edit your existing code so I recommend copying and pasting it into notepad or any text editor. Also, it’s smart at this point to create a backup of your template just in case something goes wrong. Now do a search (CTRL + F) within the text editor for the following code post-header-line-1. This is the default code that Blogger includes but some custom templates remove or change this code so you might have trouble finding it. If you can’t locate this text then try searching for %data:post.body/% instead. Your template will for sure have this since it’s the tag that actually prints the body of your post.

Now depending on which code you were able to find will determine how easy the next steps will be. You might need to do some detective work first in order to get this working properly in your custom template. The idea is to get this new code into your template before the %data:post.body/% tag. Keep reading and hopefully the explanation will illustrate the concept clear enough so you are able to adapt this hack to your custom template.

Add the following code below the %div class=’post-header-line-1′/% and %div class=’post-header-line’% tags if you’ve got both.

%b:if cond='data:blog.pageType == "item"'%
%style%.fullpost{display:inline;}%/style%
%p%%data:post.body/%%/p%
%b:else/%
%style%.fullpost{display:none;}%/style%

The result should look something like this:

If you don’t have the default %div class='post-header-line-1'/% tag then your result should look something like this instead. This is how it would be done in the MushBlue Blogger custom template:

Notice in both examples that the code in yellow and the %data:post.body/% tags are the same — it’s just tag above it that will differ based on the template you’re using.

Now let’s add one more bit of code which will actually create the “read more” link in your post. This code will go below the tag so copy the following and paste it in. Feel free to change the “Read more…” text to whatever you want the link to look like. Be careful not to delete any other code during this process.

%b:if cond='data:blog.pageType != "item"'%%br /%
%a expr:href='data:post.url'%Read more...%/a%
%/b:if%
%/b:if%

Yes, there are supposed to be two tags in the above code so don’t think it’ s a mistake. The result should look like this:


This code will be the same no matter what template you are using. Just make sure it goes below the %data:post.body/% as shown in the image above.

Now let’s look at what the final result should be. Here’s the updated code block you just worked on all put together:

Ok, you’re all done editing the template code. Paste it back into your Blogger html window and save it. If you get an error, you made a mistake. The most common mistake is to accidentally delete a > or < while pasting in the new code. If it saved successfully, it’s time to move onto the next step and modify a quick Blogger format setting.

Step #2 - Add a Class Tag in Your Default Post Template

For this step, you need to navigate in your Blogger account to “Settings” => “Formatting” and scroll all the way down to the bottom. It’s the last option called “Post Template”. You’re going to paste in the following code:

%span class="fullpost"%

%/span%

You’ll want to keep the spaces in there which will make sense later. After you save this, it will look like this:

Step #3 - Create a New Post

Ok, we’ve got everything all setup so it’s time to go and test it out. Hopefully you’ve got a new post in mind for your blog. If not, then we’ll just create a test post which you can later delete. When you click on the “Posting” tab, you’ll notice that the post text area is now pre-populated with the %span class=”fullpost”% and %/span% tags. If not, then you didn’t save it properly so go back and re-read step #2.

So when writing your new post, anything you put above the %span class=”fullpost”% tag will be the teaser text. The main body of your post needs to go in between the %span class=”fullpost”% and %/span% tags in order for the “read more…” link to work properly. See the screenshot below. Sometimes pictures illustrate better than words.

Now publish or preview your post to see the “read more” hack working on your blog. If it doesn’t show up for some reason, go back and run through the steps again. Most likely you pasted the code blocks in the wrong places. It’s difficult to troubleshoot these issues since each template can be unique so please make sure to double-check your template before asking for help in the comments section below.

Here’s the live post with the “read more…” link properly working based on the text I used above in the post text area.

Additional Info

If you want to go back and update your old posts with this new “read more…” feature you can. Just go back and edit each post manually. Essentially you’ll need to paste in the %span class=”fullpost”% and %/span% tags breaking apart the post into two parts.

For some posts, you might not want to use this feature at all. If that’s the case, just delete the %span class=”fullpost”% and %/span% tags from within your new post text area. Then your new post will show up entirely just like it used to before you implemented this hack. Enjoy!

Note: Because I don't know how to make the symbol < > available, I have replaced them by % something% in my post. If someone knows how to fix this problem, please show me. Sorry for inconvenience!

Source: http://www.eblogtemplates.com/how-to-add-the-blogger-read-more-expandable-posts-link/

-->Read the full post...

Enter your email address:

Delivered by FeedBurner

Watch the latest videos on YouTube.com
Your Name :
Your Email :
Subject :
Message :
Image (case-sensitive):