Translate This Blog
Remember To Always Back Up Your Template Before Attempting Any Of The Tweaks On This Site

Conditional "Else" Tag Explained

The "Else" tag is a addition to your normal conditional tags. It is to display different content if the conditions are met or not met.

Example:

This is the basic syntax for using "else" tag
<b:if cond='condition'>
   [content to display if condition is true]
<b:else/>
   [content to display if condition is false]
</b:if>
Red is my condition to follow.
Orange is what happens if condition is met.
Light Blue is the else tag.
Dark Blue is what will happen if the condition is not met.
Then the tag at the end is to close out this group.

Here is  another way to look at this.

Monday- Friday 
Store Hours:  10am-10pm
All other days
Store Hours: 12pm-6pm

So you can think about it in this manner.

My condition is "On Monday through Friday"
What happens is "My store is open from 10am-10pm"
If it is not Monday-Friday 
I am open  from "12pm-6pm"

So here is a practical use of the else tag that you may use.
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<style>
#Blog1 {background-color: red;}
</style>
<b:else/>
<style>
#Blog1 {background-color: blue;}
</style>
</b:if>
In this code above I am styling the background color of the Blog1 gadget to be red on the homepage and on all other pages it will display blue.

0 comments:

Post a Comment

Please don't post hyperlinked text within the comment box! It will not be published and you will be marked as spam.

Web Design Blogs PageRank