Showing posts with label Blog. Show all posts
Showing posts with label Blog. Show all posts

Free Download Blogger Template, Japanese Fleur

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

An Artistic template, Japanese Fleur, design by Lorelei, converted to Blogger by Blogger Templates, reviewed by Teiranho.


Short description; two coloum, top image background, search box, rss image which direct to your blog post feeds. I also used this template to my own blog. Interest in this template? download here. Or you can click on the image above.

Insert Google Adsense Into Blogger XML Post Body

Have you ever tried to insert the Google Adsense code directly into your Blogger XML Template and get this error?

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.



So, you resolve to insert the Adsense code using blogger widgets.
However that means your widgets can not appear within each post, the
best spots to place your ads. Don't worry, there is a way of inserting
Adsense code straight into your XML templates.

Since Blogger started using XML everything is more strict and
standardized. The above error simply mean the Adsense code is not
standized XML and solve it we need to replace all the html character such as '<' with '&gt;' '"' with '&quot;'. For example:

Quote:

<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>



would be

Quote:

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



You can use your text editor to replace all the HTML, but Blogcrowds also has an HTML parsed that takes care of everything for you. Now with the code you can paste it anywhere in your HTML code with no error at all.

Here are some tips for where in the XML Template you should paste the
parsed HTML code. I used a barebone Minima template so it should be
similar in all templates. Find the normal text and then add the bolded
code are added by me:


1)Next To The Post



<div style="float:left;">
<!--parsed Adsense code-->
</div>


<div class='post-body'>
<p><data:post.body/></p>
<div style='clear: both;'/> <!-- clear for photos floats -->
</div>


2)After Post Before Credits



<div class='post-body'>
<p><data:post.body/></p>
<div style='clear: both;'/> <!-- clear for photos floats -->
</div>

<div><!--parsed Adsense code--></div>

<div class='post-footer'>
<p class='post-footer-line post-footer-line-1'>
<span class='post-author'>
<b:if cond='data:top.showAuthor'>
<data:top.authorLabel/> <data:post.author/>


3)After Credits



<p class='post-footer-line post-footer-line-3'/>

<div><!--parsed Adsense code--></div>

</div>
</div>
</b:includable>
</b:widget>
</b:section>

If you worry this method may violate Google Adsense TOS continue reading this update.

Thanks Stavanger for sharing this. Want to read the Original Article?

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.