How to display codes and scripts in your blogger posts

Jun 29, 2010

Want to show some piece of code in your post to your readers?
Normally when you insert some code with HTML tags in your blogger composer , it will be executed and the result will be shown instead of code.

Step 1
Login to your Blogger account and navigate to Layout section. Then go to Edit Html subtab.

Step 2
Find this code ]]></b:skin> in your template code, and above this line add CSS code below and Save your Template now

.codeview {
font-family: Arial, Helvetica, sans-serif;
color: #CC0000;
margin : 15px 35px 15px 15px;
padding : 10px;
clear : both;
list-style-type : none;
border-top : 2px solid #cccccc;
border-right : 2px solid #cccccc;
border-bottom : 2px solid #cccccc;
border-left : 2px solid #cccccc;
background-color: #FFFFFF;
}
.codeview li {
font-size : 13px;
line-height : 24px;
font-family : "Courier New", "MS Sans Serif", sans-serif, serif;
color : #333333;
font-weight : normal;
margin : 0;
padding : 0;
}


Step 3
Whenever you create new posts just include the speical Script ( CSS code , Scripts , etc ) within this div section .

<div class="codeview">
Insert the Special code here
</div>


That it. If you have any problem to implement it, feel free to post a comment, I will help you.

Stop visitors from stealing your blog content

Below is a little trick that will stop your visitors from copying and pasting your blog information. Anyone with experience may know a way around this trick. However it will make it hard enough to discourage them and get them moving on to easier targets.

What to do?
Log in blogger / Dashboard --> Layout --> Add Gadget - scroll down --> HTML/JavaScript --> copy the next code and past in in HTML/JavaScript text box area

<script language="JavaScript">
<!--  
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com  
var message="Function Disabled!";  

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}  
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){ alert(message); return false;
}
}
}  
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}  
document.oncontextmenu=new Function("alert(message);return false")  
// -->
</script>

When someone will try to do right click a message will appear “Function disabled” , you can change this message too if you wish.

Enjoy.

Contact Form for Blogge

Blogger does not include the default option to install a widget or a code to generate a contact form through which visitors to your blog to send requests, suggestions, comments or just congratulate you for your work.

However, it is always the option to use external tools.

All these free services can help you to create and install a contact form in Blogger
FormSpring - Works to be included in a post in the HTML editing mode

123 Contact Form - A link to located on 123Contact Form or you can copy and paste your post in order to integrate them directly.

Kontactr - A JavaScript its deal for pasting into your Blogger post.

My Contact Form - The 14 steps to complete, click on "Get HTML" to get code and paste blogger post in HTML mode.

Pow Page Contact Us -Form is not as embedded in the page, but it appears a text link to click on and go to form, best option to insert on the sidebar.

EmailMe Form - You'll find a code to add a link that points to the contact form generated, or click on "Get the HTML Code" and get the code to insert directly into your site.

Need help, just leave a comment.

Using Title Tags to Improve SEO

Until now, the Title Tags generated for each page of your Blogger blog would display the blog title first, then the name of your post. This wasn't so good for SEO (search engine optimization) as this made keywords from your post titles appear after your blog title.

So if you want to improve SEO that is important for your blog, follow step below.

1. Go to Layout > edit HTML in your Blogger dashboard.
2. Search for this tag:
<title><data:blog.pageTitle/></title>

3. Replace(means remove code above and place code below) this tag with the following:
<b:if cond='data:blog.pageType == &quot;index&quot;'>
<title><data:blog.title/></title>
<b:else/>
<title><data:blog.pageName/></title>
</b:if>

4. Save your template.

This work only in XML blogger templates. Also is and a hack for classic bloggers, but as I know noone use classic blogger anymore.

Moving a blog to another email addres

Q1: Can I move my blog from one Gmail account to another?

Q2: I have two blogs that are on separate email addresses ID like to know how to move one to the other? I don't want the blogs combined but managed from the one email account.

Follow steps:

1. Login to Blogger Dashboard.

2. Click Settings on your dashboard --> than click Permissions tab.

3. Under Blog Authors click the ADD AUTHOR button. Copy and paste or type in the email address of the person you wish to invite or that of your second email account and click on Invite.

4. Open your Gmail for that account and check Blogger email [invitation]. Click link and activate it, you will log in blogger.

5. Now log again with your previous gmail account that you made invitation, go to permission and click give admin permission.

6. Now your blog can be managed by 2 email account, you can delete one [old] if you want.

That's it, need help, leave a comment.

How to Add a Sub-domain to a Custom Domain

Mar 22, 2010

If you get your custom domain name through google/blogger.com and your domain host is enom ,then you can follow the steps below to get a sub domain for your custom domain.

For a example if we think your domain is "123.com" and you want to get sub-domain from this domain like "blog.123.com".

1.First login to your google apps account using below URL:

https://www.google.com/a/cpanel/123.com/DomainSettingsAdvancedDns
Note : Replace "123.com" with your domain name.Look at the example below:

https://www.google.com/a/cpanel/premiumbloggertemplates.com/DomainSettingsAdvancedDns

Now you can see a screen look like below one:



2.Sign in using your username and password.Next screen will look like this:



3.Click on "Sign in to DNS console".

4.Now login to your enom account using your Domain and Password.



5.Click on the 'Edit' button under the 'Host Records' section.



6.Click 'Add New'.



7.Add your sub-domain name, for example, 'blog' under the 'Host Name' field.

8.Add ghs.google.com. under 'Address' field.

9.Select CNAME (Alias) under 'Record Type' field.

10.Now again click 'Add New'.

11.Add 'www.blog' under the 'Host Name' field.

12.Add ghs.google.com. under 'Address' field.

13.Select CNAME (Alias) under 'Record Type' field.

Your final work will look like this:



14.Click 'Save'.

You are done with Enom.

15.Login to your blogger dashboard--> settings- ->Publishing

16.Now Click on "Custom Domain".



17.Now Click on " Switch to advanced settings".



18.Now you must enter your domain name as the picture below:



19.Now click on "Save Settings".

20.Again tick "Redirect blog.123.com to www.blog.123.com" and click on "Save Settings".



21.Wait few hours.You are done.

Note: Now try to go to your sub domain.If it works fine,no problem.But It still doesn't work,again "Switch to: blogspot.com (Blogger's free hosting service)".



22.Now repeat steps 15-20 again.You are done.

You can see working examples here:

Domain : http://www.premiumbloggertemplates.com/

Sub-Domain : http://www.wpthemes.premiumbloggertemplates.com/

Statistics Widget for Blogger

Statistics Widget for Blogger

Statistics Widget For BloggerHere is my latest widget for Blogger/ Blogspot; I am going to call it Statistics Widget for Blogger. I have noticed a few sites displaying blog statistics like, total number of posts, total number of comments, total words in posts, total words in comments and similar data on their sidebar. I thought of coming out with a similar widget for Blogger.

What is Statistics Widget for Blogger?
Statistics Widget for Blogger will display the total number of posts and total number of comments on your blog. As of now, I have included only these two data for display. I do not see any value in displaying the total words in posts and total words in comments. I find them meaningless. If you are interested to display the total number of posts and total number of comments on your blog, please follow the instructions below.

Instructions to install Statistics Widget for Blogger
  1. Log in to your Blogger account

  2. On your Blogger Dashboard, click on the "Layout" link

    Layout Link

  3. This will take you to the "Page Elements" tab. Decide where you want to insert the statistics widget and click on the "Add a Gadget" link accordingly.

    Gadget Link

  4. Scroll down the list and find "HTML/ Javascript" and click on the "+" button

    HTML/ Javascript Gadget

  5. This will open the "Configure HTML/ Javascript" window. In the title section, please type "Blog Statistics" or "Blog Information" or "Blog Data" or any other title as you may wish

  6. In the content section, please copy & paste the following code:
    <script style="text/javascript">

    function numberOfPosts(json) {
    document.write('Total Posts: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
    }

    function numberOfComments(json) {
    document.write('Total Comments: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
    }

    </script>

    <ul><li><script src="http://yourblog.blogspot.com/feeds/posts/default?alt=json-in-script&callback=numberOfPosts"></script></li>

    <li><script src="http://yourblog.blogspot.com/feeds/comments/default?alt=json-in-script&callback=numberOfComments"></script></li></ul>

    <span style="font-size:75%;"><a href="http://assessmyblog.blogspot.com/" target="_blank">Widgets for Blogger</a></span>

  7. Remember to replace the text in bold "yourblog" with your blog address. Take note to replace it in two locations.

  8. Your window should look like the image below.

    Configure HTML Gadget

  9. I have a link back to my blog at the bottom. You are free to remove the credit, if you don't like it

  10. Click on "Save" button at the bottom right hand corner

That's it. You have created a widget to display the number of posts and number of comments on your blog. Please contact me if you have any doubts or you face any problems with the widget.

How to add search element to blogger

Mar 16, 2010

How to add a nice little search button to your blogger blog:

1. Click on the a Layout of your Blog in your dashboard:
2. Click on Add a Page Element:
3. Choose HTML/JavaScript and click ADD TO BLOG:
4. Put in a Title (maybe something like Search?) and put the following code in the Contents:
<form id="searchthis" action="/search" style="display:inline;" method="get">
<input id="search-box" name="q" type="text"/>
<input id="search-btn" value="Search" type="submit"/>
</form>
5. Click SAVE CHANGES




Tutorials on Blogger Template Design

Mar 2, 2010

Blogger Template Design: Introduction

This tutorial is a very quick guide to teach you how to change or design your own Blogger templates. It's easy to understand and follow, especially to those who has no knowledge in HTML programming.

The tutorial is split into a number of sub-tutorial modules that explain specific parts of Blogger template design in detail. The best way to learn is by going through the module sequence one by one. But if you are familiar with the basics, you can jump into the more advanced modules. The earlier modules are focused on explaining the basic structure of the template design and the template code so that you understand more about a Blogger template in general. The later modules explain each section of a Blogger template in more detail and help you go through the process of coding and designing a template in a step-by-step approach.

In the tutorial, some of the names and terms are based on my own template design, but I'll explain them as general as possible so you get the bigger picture and can adapt to different template designs.

Tutorial Contents


How to Embed Images as Background

Blogger Template Design: Tutorial 12

If you look at templates you'd notice that the background is not of a plain color, but made from a repeating pattern of an image. This image is called a background image. It can be a single large image that fills up the screen or a small image (say 50 x 50 pixels) that repeats horizontally and/or vertically. The neat thing about using, or embedding, a background image is that you can create any image you like and use it in your blog to make it unique and different from other blogs.

A background image can be placed in any container - either inside the Body container (which fills up the entire screen), inside the Post, Sidebar, Comment, or even on a header container (say, a Comment Header). you'll see that the Comment Header below the post is a rounded green button - which is an image embedded inside the Comment Header.

You can also use an image to create a shadowy-looking side frame (now quite common in blogs). To do this, you create a short background image with a long span that fills the whole width of the template. At the right and left edge of the background image, you create the shadowy pattern (or any other pattern that you want to be the frame), and embed this inside the outer-wrapper container, repeating it vertically.

But, how to embed and how to repeat the image vertically, horizontally, or both in directions?


To Embed Background Image:

Say that you want to use a 100 x 100 pixels image as the background image inside the Sidebar1 container. What you need to do is find the sidebar1 {...} container in CSS Styling and add the following code in red (the other codes are just sample codes):

#sidebar1 {
margin: 0px 10px 15px 10px;
padding: 0 0 0 0;
width: 150px;
background: URL(http://the-url-of-your-image) repeat left top;
text-align: left;
}


The "background:..." code will embed whatever image at whatever URL you put and repeat the pattern both vertically and horizontally. The location of the starting image will be on the left-most side, and at the top-most position. The general command for embedding a background image is:

background: URL(http://...) repeat-command x-position y-position;



All Repeat Command:
  • no-repeat (the image won't be repeated at all)
  • repeat (repeat horizontally and vertically)
  • repeat-x (only repeats horizontally)
  • repeat-y (only repeats vertically)
All Horizontal (x) Position Command:
  • left (puts the starting image on the left-most side)
  • center (puts the starting image at the center)
  • right (puts the starting image on the right-most side)
All Vertical (y) Position Command:
  • top (puts the starting image on the top-most position)
  • center (puts the starting image at the center)
  • bottom (puts the starting image on the bottom-most position)

Testing and Viewing in Other Browsers

(This is a sub-post for Step 6 from Tutorial 11: Starting Your Own Blogger Template)

(An updated content is added below.)

Personally, I don't like the stage of testing in other browsers. It's annoying that other browsers might show your blog differently than the blogs you're designing it in. But if you want all to have access to your blog and see it as nicely as you've designed it, then you have to go through this process. As for my blog and my demo blogs, I designed them in Firefox and tested in IE7. I've received comments that people using IE6 have some trouble with the templates, but I didn't test them in IE6, and not about to trouble myself downloading IE6 and debugging the codes. The way I see it, if Firefox and IE7 get it right, then it's IE6 that's got the problem (not my templates) and it's IE6 that has to debug itself. Anyway, isn't that why IE7 is made in the first place?

Personally, I think Firefox is by far above all. If you're not using Firefox, I suggest you download them right now - it's free, fast, not too crowded with useless buttons, lightweight, and just plain great. And if you're using IE6 and don't want to upgrade to IE7 because your computer is not fit enough to take the load, but you know that viewing blogs is prone to bugs - then Firefox should be the way to go. Plus, the download is quick, the upgrading is efficient and fast, and there's a lot more to this - but I'll just let you see them on your own. So, if you want to get rid of IE and use Firefox instead, the download button is on the sidebar...

I don't really have a tip for debugging. You just have to be patient and solve the problems one by one. The way I avoid problems is by writing a stricter code so they won't have a chance to flip flop or get 'loose'. If you want, you can start designing a template starting from any of my own templates. That way, you can maintain the part of the CSS code that's there to avoid any bugs in different browsers. But I can't guarantee they're 100% bug-free!

Update:
I have tested all the templates in all browsers using Browsershots.org and labeled the ones compatible with all browsers (including IE6). There are also some templates compatible with IE6, but have their sidebars pushed down the Blog Posts because their content-box width is wider than the sidebar. So, please check if this is the case if you see your sidebar misaligned.

Tweaking the CSS Code

(This is a sub-post for Step 5 from Tutorial 11: Starting Your Own Blogger Template)

This is the crucial part of designing - setting how your blog looks like. By this time the widths of all the containers inside the CSS code should have been set. What you need to know about tweaking the CSS code is that it's a recursive process - it's a process of refining that always repeats back and forth until you're 'happy' with the end result.

There are so many things to tweak and so many containers to customize. So how do you do this and where do you start? The easiest approach is to start from the top. Assuming that you're starting from an existing template, at this point you don't have to worry much about customizing the body, outer-wrapper, and content-wrapper, except the width. You can tweak these containers later (or let the existing code as default, unless you want to tweak them later). If you want to use an image as a background image of the whole template, you can also do this later.

Read Tutorial 3: The Structure of CSS Styling Section first if you're not familiar with the basics of the CSS Styling part of the code. Also remember that you should not expect your design to be perfect the first time you do it. It's a process that takes time. To know the basics of tweaking the CSS code, read Tutorial 4: Setting the Properties of a Container. And, if you don't know what containers to customize, read Tutorial 5: Common Containers and Elements in a Blogger Template.


Header:
I'd suggest you start with the Header section. What you commonly need to do here is to set the background color, set how the Blog Title and Blog Description looks like - the font, colors, font-size, etc. If you want to set a large background image as the header image, set it using the Edit Header button in the Page Elements page. The list below is from Tutorial 5.

  • #header-wrapper - the container that wraps your Blog Title and Blog Description.
  • #header - the container just inside the header-wrapper.
  • #header h1 - the command inside this containers controls the appearance and layout of your Blog Title.
  • #header h1 a - controls the properties of the Blog Title as a link text.
  • #header .description - the properties of your Blog Description.
  • #header a img - controls the properties of an image inside your header container.

Main and Post:
The next container to tweak is the Main and Post containers (including the Post-Footer). This one will take most of your time because there's a lot of subcontainers inside it. Infact, Post is a subcontainer of Main. It's usually easiest if you tweak the subcontainers following a certain order. My suggestion is to follow the order below. The list below is from Tutorial 5.

Main:
  • #main-wrapper - the container that wraps your Date Header, Blog Posts, Comments, Feed Link, and any widgets that you drag above or below the Blog Posts.
  • #main - the container just inside the main-wrapper.
  • #main .widget - controls the properties of all widgets inside the main container.
  • h2.date-header - sets the properties of your Date Header (just above your Post Title).
  • .post - sets the properties of your Blog Posts container.
  • .post h3 - sets the properties of your Post Title.
  • .post-body p - sets the properties of the body or content of your post.
  • .post ul - sets the properties of an unordered list (a list that is not numbered).
  • .post ol - controls the properties of an ordered list (a numbered list).
  • .post li - controls the properties of the individual list inside an unordered list or an ordered list.
  • a img - controls the general properties of an image (the a refers to a link; and an image is by itself a link).
  • blockquote - sets the quoted text in your posts.
  • code - sets the text contained within the code tags in your posts.
Post-Footer:
  • .post-footer - sets the overall properties of the post-footer container.
  • .post-footer-line - sets the properties for each new lines in the post-footer.
  • .post-footer a - sets the link text properties inside the post-footer.
  • .post-footer .post-comment-link a - sets the "comment" link inside the post-footer.
  • #blog-pager - controls the properties of the "newer posts", "home", and "older posts" links.
  • #blog-pager-newer-link - controls the properties of the "newer posts" link.
  • #blog-pager-older-link - controls the properties of the "older posts" link.
  • .feed-links - controls the "Subscribe to: Posts (Atom)" link.

Sidebars:
Once you're done with the above, customize the sidebar. If you have more than 1 sidebar, you may want to customize each sidebar differently. You'll also need to customize the Profile container and the Blog Archive if you want them to be different from other sidebar widgets. The list of container elements from Tutorial 5 are:
  • .sidebar-wrapper - the container that wraps all elements and contents in a sidebar.
  • .sidebar - the container just inside the sidebar-wrapper.
  • #sidebar1 - sets the properties inside sidebar1.
  • #sidebar2 - sets the properties inside sidebar2. If you want the properties inside sidebar1 and sidebar2 to be the same, than you can just the properties inside .sidebar and don't have to even write down the #sidebar1 and #sidebar2 in your CSS code.
  • .sidebar .widget - controls the properties of all the widgets (the Added Page Element) in your sidebar.
  • #sidebar1 .widget - only sets the widgets in sidebar1.
  • .sidebar .BlogArchive - sets the Blog Archive properties. Technically, this is a sidebar widget too, but I'm not sure why setting the properties for sidebar widgets doesn't change any properties for the Blog Archive. That's why I have to write down the .BlogArchive command to set its properties.
  • .sidebar h2 - sets the title/header properties of a sidebar widget.
  • .sidebar #BlogArchive1 h2 -sets the properties of the Blog Archive's title.
  • #Profile1 - sets the properties for the About Me block.
  • #Profile1 h2 - sets the title/header for the About Me block.
  • .profile-img a img - sets the image in the About Me block.
  • .profile-textblock - sets the author description About Me block.
  • .profile-data - sets the author's data in the About Me block.
  • .profile-datablock - sets the overall blocks of data in the About Me block.

Comments:

After the sidebars are done, customize the Comments container next. Post a few test comments to see how they will appear after tweaking. The list of container elements from Tutorial 5 are:
  • #comments - sets the overall comment container's properties.
  • #comments a - sets the link text properties inside a comment container.
  • #comments h4 - sets the header of the comment container.
  • .deleted-comment - sets the properties of the deleted comment.
  • .comment-author - sets the properties of the comment author.
  • .comment-body p - sets the comment body properties.
  • #comments ul - controls the unordered list inside a comment container.
  • #comments li - controls the individual list inside a comment container.

Footer:

The last container to be customized is the Footer. The list of container elements from Tutorial 5 are:
  • #footer-wrapper - the container that wraps all elements and contents inside a footer section.
  • #footer - the container just inside the footer-wrapper.
  • #footer h2 - sets the properties of the footer title/header.
  • #footer .widget - controls the footer widget properties.
  • .footer a - controls any footer link texts.

Refining Touch:

Now that you're done customizing all the containers, what you need to do is go back and take a look at your blog as a whole and do some minor tweakings. What I suggest here is you might want to change some font or background colors, font size, margins and paddings, adding borders or changing the borders colors, and so on. But when adding borders, be careful that it might change the width of the container that you're adding the borders on. If there are problems (say that the Sidebar is pushed below the Blog Post), you'll need to increase the width of the parent container that it's in.

The best way to change background and font colors is to have them as variables so that you can use the Fonts and Colors tab in the Layout page.

Setting the Template Size

Blogger Template Design: Tutorial 7

Setting the template size is probably one of the first things you need to do when starting to design a new template. The are two ways to set the size (basically the width) of a template:
  1. Setting the size to be fixed with a certain width, say 800 pixels.
  2. Setting the template to have a fluid size, which means the width changes with the browser or screen size.
Setting a fixed template size:
To set a template width, you actually have to set the width of a few large containers. The most common containers to set the widths are:
  1. Body
  2. Outer-wrapper
  3. Header-wrapper
  4. Content-wrapper
  5. Footer-wrapper
  6. Main-wrapper
  7. Sidebar-wrapper*
  8. Footer-wrapper
*Note: You can also just set the widths of sidebar1 and sidebar2 containers without setting the sidebar-wrapper width. Setting the sidebar-wrapper width is convenient if both sidebars have equal widths.

In most of my newest templates, I also set the widths in the containers just inside some of the wrapper containers (which is redundant) to avoid some minor alignment bugs that may appear. The widths of these containers are set equal to the widths of their parent wrapper containers. These containers are:
  1. Header
  2. Main
Here is a sample code from the Generic Blogger Template showing you all the container widths that are set to make sure the template width is properly set (only the part that concerns the width-setting are shown). In this sample, the template width is set at 800 pizels.

body {
min-width: 800px; }

#outer-wrapper {
margin: 0 auto; /* to make the template lays in the screen center */
min-width: 800px;
max-width: 800px; }

#content-wrapper {
min-width: 800px;
max-width: 800px; }

#header-wrapper {
min-width: 800px;
max-width: 800px; }

#main-wrapper {
min-width: 400px;
max-width: 400px; }

.sidebar {
padding: 10px 10px 10px 10px;
min-width: 180px;
max-width: 180px; }

#sidebar1 {.....}
#sidebar2 {.....}

#footer-wrapper {
min-width: 800px;
max-width: 800px; }

The body is set with a command min-width = 800px, which means that the smallest width it should have is 800px. If it's set with a command width = 800px only, then the template width might shrink in some situation. Setting it with a min-width guarantees the smallest size it will take.

The next container just inside the body is the outer-wrapper. It's usually common to set it with a command width = 800px only. But as I've explained about my strictness in setting the width to avoid any alignment bugs, it's becoming my habit to always set the container to have a min-width and max-width of the same value so that the container size is exactly that size - it will not shrink or widen to any different value. Another thing about the outer-wrapper is that this is where you set the command to either place your template at the center of screen or float to the left of it. In this case, setting margin: 0 auto will float the template to the center. Just writing margin: 0 will float it to the left as a default position.

The next 3 large containers, the header-wrapper, the content-wrapper, and the footer-wrapper is usually set to be the same size; in this case it's 800px. In any case, they can be set smaller than the outer-wrapper width but not any bigger than that because the outer-wrapper 'wraps' these 3 containers inside it. Another thing, if you add left and right borders, then you'll increase the width, and the outer-wrapper will just cut out whatever that's bigger than itself on the right side. So, if you do add borders, say 2px left and 2px right for the header-wrapper, then you have to set the header-wrapper width to be 796px so that the total would be 796+2+2 = 800px. The same goes for all the other containers.

The last 3 containers are the 2 sidebars and the main-wrapper. Because they sit side by side, you have to make sure the total width = 800px or less, but certainly not more. In this case, I set the main-wrapper to be 400px and both the 2 sidebars to be 200px. But because I added padding of 10px left and right of each sidebars, which pushes the sidebar border outward, I'd have to reduce the sidebar width to be 180px so that the total sum after adding the pads would be 200px. You have to note that the largest sidebar container is the sidebar-wrapper (not just the sidebar). I could have set the width of the sidebar-wrapper instead of the sidebar, but I prefer to set the sidebar width because sometimes I may set the 2 sidebars to have different widths. But, this is all just a matter of personal style; other template designers may have different way of setting this sidebar widths. As long as it works, that's all that matters.
Setting a fluid template size:
To set a template with width that changes with browser or screen size, please refer to W3Schools Tutorials for more details. In my templates, I haven't made any such templates and so my experience in setting a fluid sized template is not much. Once I have more experience in this, I'll post the tutorials on it.
***************************************
Next Tutorial:
The next step in this tutorial is a quick explanation on the Body section of the Blogger template code.

The Body Section of the Blogger Template Code

Blogger Template Design: Tutorial 8

In this tutorial, I'll explain the basic structure of the Body of the code so that you get the idea on how it works with the rest of your code. The code is located in Section 3 of the Blogger Template Code Structure. This is the main part of the Blogger template code that retrieves the data to be displayed on your blog. It's basically the core part that makes your whole blog functions. The code that sets how it appears on your blog is the CSS Styling code.

Refering back to the tutorial Blogger Template Code Structure, the Body code is in Section 3 as shown in the image below.


Shown below is the Body code copied exactly from the Blogger Edit HTML page with the 'Expand Widget Button' unchecked. I do not want to include the complete code by checking the 'Expand Widget Button' for 2 reasons. First, it's not necessary to do this. You actually don't even have to know what goes on inside the complete code to be able to design a properly working Blogger template. That's all been done 'automatically' by Blogger, which is the beauty of using this new Blogger template as oppose to the old classic ones. Second, by looking at this simpler version of the code, you'll be able to grasp easier the main idea of how all the containers in the template are laid out.


<body>
<div id='outer-wrapper'><div id='wrap2'>

<!-- skip links for text browsers -->
<span id='skiplinks' style='display:none;'>
<a href='#main'>skip to main </a> |
<a href='#sidebar'>skip to sidebar</a>
</span>

<div id='header-wrapper'>
<b:section class='header' id='header' maxwidgets='1' showaddelement='no'>
<b:widget id='Header1' locked='true' title='Testpage Two (Header)' type='Header'/>
</b:section>
</div>

<div id='content-wrapper'>

<div id='main-wrapper'>
<b:section class='main' id='main' showaddelement='no'>
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>
</b:section>
</div>

<div id='sidebar-wrapper'>
<b:section class='sidebar' id='sidebar' preferred='yes'>
<b:widget id='Profile1' locked='false' title='About Me' type='Profile'/>
<b:widget id='BlogArchive1' locked='false' title='Blog Archive' type='BlogArchive'/>
<b:widget id='Label1' locked='false' title='Labels' type='Label'/>
</b:section>
</div>

<!-- spacer for skins that want sidebar and main to be the same height-->
<div class='clear'>&#160;</div>

</div> <!-- end content-wrapper -->

<div id='footer-wrapper'>
<b:section class='footer' id='footer'>
<b:widget id='Text1' locked='false' title='Blogger Template | Bordr' type='Text'/>
</b:section>
</div>

</div></div> <!-- end outer-wrapper -->
</body>


For simplicity, ignore the code in light grey. They are either comments or 'default' codes to make things work properly that doesn't need to be tampered with. The core part of the codes can be sectioned into 4 parts:
  1. Header (in red)
  2. Main (in green)
  3. Sidebar (in red)
  4. Footer (in brown)
You'll see in the above that all the codes are first wrapped in the body tag, followed by the outer-wrapper tag, then the wrap2 tag. These wrappers are used to group the containers together so that they can be easily editted together. Using wrappers also make placing the containers much easier especially if you want to use additional sidebars or extra containers (such as a banner or linkbar containers as in most of my templates). In the explanation below, I'll only refer to the outer-wrapper as the larger wrapper without referring at all to the wrap2 wrapper. They're just the same (I'm not even sure why the wrap2 is there in the first place).

Inside this large container, you'll see 3 wrappers - header-wrapper, content-wrapper, and footer-wrapper. They are positioned vertically with the header-wrapper being at top and the footer-wrapper being at the bottom. It's simply because in the code, the header-wrapper is called first, followed by the content-wrapper, and finally the footer-wrapper. At this point, you don't even have to know what's inside the content-wrapper - this makes it much cleaner and easier as oppose to not having the content-wrapper and having to deal with the main-wrapper and sidebar-wrapper together all at once. It'll be a big mess then.

Because the outer-wrapper is the largest wrapper, you have to make sure that the widths of all the other wrappers inside it is less or at least equal to the outer-wrapper's width. But, if you add borders, that'll add extra pixels to whichever wrapper that you're adding the borders too. So be careful when adding borders!

Adding a new wrapper (container) in between any of these wrappers is easy. Just paste in a wrapper code (see below for example) and rename it with a new name, say a banner-wrapper. The preferred='yes' command will make an 'Add Page Element' button that'll allow you to create new widgets.

<div id='banner-wrapper'>
<b:section class='banner' id='banner' preferred='yes'>
</b:section>
</div>


Adding a wrapper only creates a new container, or block, in your blog. In doesn't set how it's going to look or where it's going to be located. To customize how it looks and where it's located in the blog, you NEED to tweak the CSS codes.

Inside the content-wrapper, you have the main-wrapper and sidebar-wrapper. To have these two wrappers side-by-side as commonly seen in blogs, you have to set the widths of these 2 wrappers such that it's equal or less than the width of the content-wrapper. Plus, you have to add certain commands in the CSS Styling code so that they'll sit next to each other. Otherwise, they'll just fall vertically on top of one another. Typically, you need to use the 'float:left' command for this. See some template examples to check more on this. If you want to add more sidebars, say a 3-column template, you simply need to add more sidebar-wrapper code (in blue). Read more in Tutorial 10 to know how to add or change sidebars.

Once you've understood the basic idea behind the Body code, it's easy to see now why the common structure of the Blogger template code looks the way it is (see below for a 3-column example). If you want to rearrange or add new containers or wrappers, what you simply need to do is to modify the Body of the code. It's that easy! But then, you have to tweak the CSS code to set how it's gonna look in the blog.


***************************************
Next Tutorial:
More explanation about the Body section of the code is given in Tutorial 9.

Starting Your Own Blogger Template

Blogger Template Design: Tutorial 11

Now that you've gone through all the tutorials, you're pretty much ready to start designing your own template. In this guide, I'll show you the big steps that you have to go through to make a template the fast and easy way.

The first thing you need to understand about designing a template is that the technique of designing is unique and different between individuals. In the end, it's entirely up to you how you want to do it - if and only if you're familiar and have made a few templates yourself. But if you're just beginning, it's best to follow a step-by-step guide to expedite the process and so that you won't get lost.


Step 1 - Choose an already-made template as a starting point:For beginners, the easiest and fastest way to start designing is by starting from an existing template. But don't do it with the intention of plagiarizing it!

Step 2 - Setting the number and location of your sidebar columns:If you're a beginner, make sure you start with a template that closely resembles the template that you have in mind. For example, if you want to do a 3-column template, don't start with an existing 2-column template. Or, if you want to change or add more sidebars yourself, read more about how to do it in Tutorial 10: Making a 3-Column Template and More ...
Step 3 - Setting the width of your template:
The first thing you need to do after getting a starting template is to set the width of your template. To do this, you need to set the width in the CSS Style code. It's all explained in detail in Tutorial 7: Setting the Template Size. The common containers to set the widths are:
  • body
  • outer-wrapper
  • content-wrapper
  • header-wrapper
  • main-wrapper
  • sidebar-wrapper (or sidebar1, sidebar2, and so on)
  • footer-wrapper
You can either set the width to be fluid (changes its width accordingly with the browser or screen size) or set the width to be fixed. Note that setting the width inside the container-wrapper can be a bit tricky because you have the Main and Sidebar containers in it. If the width is not set well, the Sidebars can fall below the Main container.

Step 4 - Build test objects:If you're designing a new template, how do you know that what you're tweaking is right if you can't see the changes? So, what you need to do here is build some test objects - for example post 3 or more test posts that have a quote, a numbered list, un-numbered list, make lots of widgets to see how the sidebars look like, make sure you have some Labels to show up in your Labels widget, make some test comments to see how they look, and so on.

Step 5 - Tweaking the CSS code to customize your blog's appearance:

Here is where you start tweaking the CSS code to customize the basic layout of your blog and slowly refining it until you have the template that you want. It's a process that keeps you going back and forth re-tweaking codes because you won't usually get things perfect the first time. Read more detail in the sub-post Tweaking the CSS Code.

Step 6 - Testing in other browsers:

This step can get really annoying, but like they say, you've got to do what you've got to do. Read more in the sub-post Testing and Viewing in Other Browsers.

Step 7 - Using images as background:


If you're bored of using plain color, you can use nicer images as the background of the whole blog or the background of some of the containers (e.g. the Post, Sidebar, Footer, Header, etc). To learn how to do this, click on Tutorial 12: How to Embed Images as Background.

Step 8 (The Final Step) - Finalizing your template:

This step is like the proof-reading stage of your writing. You just need to go through one last step to double check that everything works fine and okay. Look at your blog carefully and see if some minor tweaking will make it look better.

The Body Section of the Blogger Template Code

Blogger Template Design: Tutorial 12

you'd notice that the background is not of a plain color, but made from a repeating pattern of an image. This image is called a background image. It can be a single large image that fills up the screen or a small image (say 50 x 50 pixels) that repeats horizontally and/or vertically. The neat thing about using, or embedding, a background image is that you can create any image you like and use it in your blog to make it unique and different from other blogs.

A background image can be placed in any container - either inside the Body container (which fills up the entire screen), inside the Post, Sidebar, Comment, or even on a header container (say, a Comment Header). For example, if you look at the a template, you'll see that the Comment Header below the post is a rounded green button - which is an image embedded inside the Comment Header.

You can also use an image to create a shadowy-looking side frame (now quite common in blogs). To do this, you create a short background image with a long span that fills the whole width of the template. At the right and left edge of the background image, you create the shadowy pattern (or any other pattern that you want to be the frame), and embed this inside the outer-wrapper container, repeating it vertically.

But, how to embed and how to repeat the image vertically, horizontally, or both in directions?


To Embed Background Image:

Say that you want to use a 100 x 100 pixels image as the background image inside the Sidebar1 container. What you need to do is find the sidebar1 {...} container in CSS Styling and add the following code in red (the other codes are just sample codes):

#sidebar1 {
margin: 0px 10px 15px 10px;
padding: 0 0 0 0;
width: 150px;
background: URL(http://the-url-of-your-image) repeat left top;
text-align: left;
}


The "background:..." code will embed whatever image at whatever URL you put and repeat the pattern both vertically and horizontally. The location of the starting image will be on the left-most side, and at the top-most position. The general command for embedding a background image is:

background: URL(http://...) repeat-command x-position y-position;



All Repeat Command:
  • no-repeat (the image won't be repeated at all)
  • repeat (repeat horizontally and vertically)
  • repeat-x (only repeats horizontally)
  • repeat-y (only repeats vertically)
All Horizontal (x) Position Command:
  • left (puts the starting image on the left-most side)
  • center (puts the starting image at the center)
  • right (puts the starting image on the right-most side)
All Vertical (y) Position Command:
  • top (puts the starting image on the top-most position)
  • center (puts the starting image at the center)
  • bottom (puts the starting image on the bottom-most position)

Making a 3-Column Template and More ...

Blogger Template Design: Tutorial 10

One of the most basic desires after becoming a Blogger's blogger and using the standard template for a while is having the urge to find a 3-column template. So, here's a simple and straight-forward tutorial on how to do this yourself without going through too much of code tweaking.

This tutorial is prepared assuming you understand the stuff covered in Tutorial 8 and Tutorial 9, which explain the basics of the Body section of the code.

What we'll be doing to change or add sidebars is simply tweaking the XML code directly from the Blogger Edit HTML page WITHOUT turning the Expand Widget Templates on. This means that the Body section at the end of the code won't be shown cluttered with detailed algorithms for widgets and post data. It'll be as simple as it can be, which is definitely a good thing :).


Adding a Sidebar to Make a 3-column Template:When you scroll down to the Body section, the code might have something that looks close to this example below (note that you can have slightly different variations of this code for different templates):

Example of a 2-column template:

<div id='content-wrapper'>

<div id='main-wrapper'>
<b:section class='main' id='main' showaddelement='no'>
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>
</b:section>
</div>

<div class='sidebar-wrapper'>
<b:section class='sidebar' id='sidebar1' preferred='yes'>
</b:section>
</div>

<!-- spacer for skins that want sidebar and main to be the same height-->
<div class='clear'> </div>

</div> <!-- end content-wrapper -->


The above shows a 2-column-template code within a wrapper called the content-wrapper which contains the main-wrapper (which contains the Blog Posts) and the sidebar-wrapper.

To make another sidebar, what you need to do is simply go to the Edit HTML page and without turning on the Expand Widget Templates box, paste another block of sidebar-wrapper code (shown above in red) before or after the main-wrapper block. For example, to make the Sidebar-Main-Sidebar column, place it before the main-wrapper. Notice in the example below that the id of the 1st sidebar-wrapper is sidebar1 and the id of the 2nd one is sidebar2.

Note: You also have to make sure that the width of both Sidebars and the Main blocks will fit inside the content-wrapper and that the CSS code is properly written for the Sidebars to lay next to each other. Some common mistakes are that one or both Sidebars will fall below the Main block.

Example of a 3-column S-M-S template:

<div id='content-wrapper'>


<div class='sidebar-wrapper'>
<b:section class='sidebar' id='sidebar1' preferred='yes'>
</b:section>
</div>


<div id='main-wrapper'>

<b:section class='main' id='main' showaddelement='no'>
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>
</b:section>
</div>

<div class='sidebar-wrapper'>
<b:section class='sidebar' id='sidebar2' preferred='yes'>
</b:section>
</div>

<!-- spacer for skins that want sidebar and main to be the same height-->
<div class='clear'> </div>

</div> <!-- end content-wrapper -->



Changing the Sidebar Location:If you want to change a sidebar location to make a 3-column template with a configuration of Main-Sidebar-Sidebar for example, what you need to do is place the sidebar-wrapper block where you want it to appear.

To do this, simply go to the Edit HTML page and without turning on the Expand Widget Templates box, cut the 1st sidebar-wrapper code and paste it in between the main-wrapper and sidebar2 blocks. See the sample code below:

Example of a 3-column M-S-S template:

<div id='content-wrapper'>


<div id='main-wrapper'>

<b:section class='main' id='main' showaddelement='no'>
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>
</b:section>
</div>

<div class='sidebar-wrapper'>
<b:section class='sidebar' id='sidebar1' preferred='yes'>
</b:section>
</div>
<div class='sidebar-wrapper'>
<b:section class='sidebar' id='sidebar2' preferred='yes'>
</b:section>
</div>

<!-- spacer for skins that want sidebar and main to be the same height-->
<div class='clear'> </div>

</div> <!-- end content-wrapper -->


Now you basically know how to add or change sidebar locations. They're that simple!

***************************************
Next Tutorial:
The next tutorial is on how to start your own Blogger template.