Saturday, 27 November 2010

Adding adsense ads to Simplex Transcript template

Simplex Transcript has no widget ready function ,so if you want to add adsense ads to this template ,you have to insert them directly to template code . This task is very easy if you are familliar to coding ,but not with the one who doesn't . So in this post ,I will show you the way to adding adsense ads to Simplex Transcript template in both of homepage and single page ,this post is also a solution for everyone who met the trouble adsense ads not show up in single page .



1,Before adding ads code

find this line :
<div id="frontpage">
and add this line right before the line you've just found :
<b:if cond='data:blog.url == data:blog.homepageUrl'>

next, find this line :
<div id="singlepage">
and add this line right before the line above
</b:if>

2,If you want to add adsense in home page :
   
     2a,to add ads in sidebar ,above " the most recent" tabs :
find this <h2 class='widget_title'>MOST RECENT</h2>  and add the adsense code right before this line .

     2b,to add ads in the left ,next to middle content tab ,find this line :<div id='primaryBottomSidebar'>
and add adsense code right after this .

     2c,To add ads in the right bottom corner ,find this line :
<div class='home_sidebar_ads'>
and add your adsense code right after this line .

3,To add adsense ads in single page
   
     3a,adsense ads under the archive column ( in the middle)
find this line :<div class="t_center marginbottom">
and add the adsense right after this line .

     3b,Adsense ads in the right ,above recent comment widget
find this line :  <div id="wideSidebar">
             <div class="widget1">
and add the adsense right after these line .

I see many of you gave up using this template just because can't adding adsense code or customize it as your need . With this post ,I hope you will feel more convenient when using Transcript template .

Jcarousellite and carousel slider for content

Some people asked me how to make a content slider like media section in templates Simplex Transcript and Simplex Blognews . Content slider in media section was made using a plugin of Jquery ,Jcarousellite .



To install this plugin into your site ,you can follow instruction bellow


1,Download jquery frameword here and Jcarousellite here
You can also download Mousewheel plugin if you want to move slider by mousewheel and Easing plugin if you want interesting effects for slider
Then upload these files to a host that support javascript .

2,Go to Blogger Dashboard ,continue to Design ,and to Page elements .Create a HTML/Javascript widget and then paste the following script into widget content .
<script type="text/javascript" src=" path to jquery.js"></script>
<script type="text/javascript" src="path to jcarousellite.js"></script>

<!-- Optional -->
<script type="text/javascript" src="path to easing.js"></script>
<script type="text/javascript" src="path to mousewheel.js"></script>

remember to change path to .... (marked in bold) to URL of js files hosted in step 1 .

3,HTML Structure of carousel slider like bellow :
<button class="prev"><<</button>
<button class="next">>></button>
       
<div class="anyClass">
    <ul>
        <li><img src="someimage" alt="" width="100" height="100" ></li>
        <li><img src="someimage" alt="" width="100" height="100" ></li>
        <li><img src="someimage" alt="" width="100" height="100" ></li>
        <li><img src="someimage" alt="" width="100" height="100" ></li>
    </ul>
</div>

copy this script and paste bellow the code in step 2 .Replace the text in bold to anything you want to show in carousel slider . You can add a little of CSS for decorating your carousel slider by a code like this :

<style>
.prev { .....}
.next { .....}
.anyclass {.....}
.anyclass ul { .....}
.anyclass ul li {.......}
</style>
replace .... with CSS attributes to make carousel slider displayed as you want .
This CSS code should be place above HTML structure in HTML/Javascript widget .

4,After having elements for carousel slider ,we can make it work by adding this under the code in step 3 :
$(function() {
    $(".anyClass").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev"
    });
});

5,Save widget and we have a carousel slider for site or blog . The code in this post is not completed ,you have to add CSS or HTML to make it display as you want . Jcarousel also comes with some options and its option can be see here

6,If you want to show latest posts in a category in carousel slider ,you can using Jcarousel code with Recent post code as the way showed in this post or this post
You can also see the code of my templates for more detail .

I hope this post helpful to you .

Friday, 19 November 2010

Numbered page navigation for Simplex Templates

Many people ask me a numbered page navigation for Simplex templates . With a lot of modifications ,Simplex templates have diferrent structure to Blogger default template ,so it's hard to find the code , insert numbered page navigation and make it work well . In this post ,I want to show you the a tip for making numbered page navigation in blogspot ( and Simplex templates ) without headache and easy to follow .
This tip is not mine ,I found it on Hontap blog by the comment of Taiki in my blog . Thanks Rilwis at hontap blog for the script and Taiki for your recommendation .
You can see numbered page navigation in my latest template Simplex Focus .


 

Here is instruction to make numbered page navigation :


1,Find this line ]]></b:skin> and insert the code bellow right before:
/* Page Navigation */
.pagenavi{clear:both;margin:10px auto;text-align:center}
.pagenavi span,.pagenavi a{padding:3px;margin-right:5px;background:#fff;border:1px solid #c20c0c}
.pagenavi a:visited{color:#c20c0c}
.pagenavi a:hover,.pagenavi .current{background:#c20c0c;color:#fff;text-decoration:none}
.pagenavi .pages,.pagenavi .current{font-weight:bold}
.pagenavi .pages{border:none}

this is CSS code of numbered page navigation .

2,Find this line :
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'>
and insert this code right after the line above
<b:includable id='page-navi'>
    <div class="pagenavi">
        <script type="text/javascript">
        var pageNaviConf = {
            perPage: 5,
            numPages: 9,
            firstText: "First",
            lastText: "Last",
            nextText: "Next",
            prevText: "Prev"
        }
        </script>
        <script type="text/javascript" src="http://rilwis.googlecode.com/svn/trunk/blogger/pagenavi.min.js"></script>
        <div class="clear" />
    </div>
</b:includable>

3,Find this code :
<b:include name='nextprev'/>
and replace it with
<b:if cond='data:blog.pageType == "index"'>
    <b:include name='page-navi' />
    <b:else/>
    <b:if cond='data:blog.pageType == "archive"'>
        <b:include name='page-navi' />
     <b:else/>
        <b:include name='nextprev'/>
    </b:if>
</b:if>

Save template and you are done .
To change the number of page displayed and number of post per page ,you can change the value in step 2 :
perPage: 5,
            numPages: 9,
            firstText: "First",
            lastText: "Last",
            nextText: "Next",
            prevText: "Prev" 
perPage :  number of post per page .
numPages : number of page displayed .
firstText ,lastText,nextText and prevText are the texts used in page navigation .


Note :
- Value of perPage variable and the maximum number of post per page in Blogger Dashboard should be equal . For example ,if you set the value of perPage in step 2 is 5 , after saving template ,go to Blogger Dashboard -> Settings -> Formatting ,and change the value of Show at most to 5

- You can change the CSS in step 1 to make numbered page navigation displayed as you want .

That's all . I hope it helpful to you .

Wednesday, 17 November 2010

Make verticall scrolling banner

When surfing some websites ,I see vertical banners scroll along left side and right side . That's a good idea for attracting visitors to banner ads and increase the clickthrough rate of sites .




Live Demo

Do you want to make a scrolling banner for your sites ? here is script for you

Just copy this script and paste it right after <body> tag

<style type="text/css">
.float {
width: 150px;
height: 800px;
border: solid 1px white;
}
</style>

<!--code of scrolling banner -->

<div id="rightbanner" class="float"><a href="http://simplexdesign.blogspot.com"><img src="link to your banner" border="0"></a></div>
<div id="leftbanner" class="float"><a href="http://simplexdesign.blogspot.com" target="_blank">
<img src="link to your banner" border="0"></a></div>

<script type="text/javascript">
function setPosition(id, position) {
var store = {
ram : {
top : 0,
left : 0,
right : 0,
bottom : 0
},
rom : {
top : null,
left : null,
right : null,
bottom : null
}
};

for (var i in position) {store.rom[i] = position[i];}
var element = document.getElementById(id);
for (i in store) {element[i] = store[i];}
element.rom.move = function() {
if (window.innerHeight) {
var topPage = window.pageYOffset;
var leftPage = window.pageXOffset;
var rightPage = leftPage + window.innerWidth - element.offsetWidth;
var bottomPage = topPage + window.innerHeight - element.offsetHeight;
}
else {
var topPage = document.body.scrollTop;
var leftPage = document.body.scrollLeft;
var rightPage = leftPage + document.body.clientWidth - element.offsetWidth;
var bottomPage = topPage + document.body.clientHeight - element.offsetHeight;
}

element.style.position = "absolute";
if (element.rom.top != null) {
element.ram.top += Math.round((topPage + element.rom.top - element.ram.top)/20);
element.style.top = element.ram.top;
}
if (element.rom.left != null) {
element.ram.left += Math.round((leftPage + element.rom.left - element.ram.left)/20);
element.style.left = element.ram.left;
}
if (element.rom.right != null) {
element.ram.right += Math.round((rightPage - element.rom.right - element.ram.right)/20);
element.style.left = element.ram.right;
}
if (element.rom.bottom != null) {
element.ram.bottom += Math.round((bottomPage - element.rom.bottom - element.ram.bottom)/20);
element.style.top = element.ram.bottom;
}
setTimeout("document.getElementById('"+element.id+"').rom.move()",10);
};
element.rom.move();
}

setPosition("a", {top: 0, left: 880});
setPosition("c", {top: 0, left: 20});

</script>


<!--end code -->

Remember to change the image link to your banner's and change the target url (I marked them in bold)
Position of two banners are set by two code lines


setPosition("rightbanner", {top: 0, left: 880});
setPosition("leftbanner", {top: 0, left: 20});

The line
setPosition("rightbanner", {top: 0, left: 880});
mean :
-The distance between right banner and top of browser window is 0
-The distance between right banner and left of browser window is 880 pixel

Left banner is similar to rightbanner

You can change these values for the best display in your site .
That's all .I hope this tip helpful to you