The Switches Blogger Syntax
Blogger XML Language
<b:switch var='EXPRESSION'> <b:case value='EXPRESSION1'/> <!-- execute case match VALUE1 code block --> <b:case value='EXPRESSION2'/> <!-- execute case match VALUE2 code block --> <b:default/> <!-- execute case default code block if all case doesn't meet. --> </b:switch>
Switches tag Example
With String
<ul> <b:loop values='["Fruit","Food","Other"]' var='MyList'> <li><data:MyList/></li> <b:switch var='data:MyList'> <b:case value='Fruit'/> <b:loop values='["Apple","Mango","Orange"]' var='Fruit'> <ul> <li><data:Fruit/></li> <b:switch var='data:Fruit'> <b:case value='Apple'/> <b:loop values='["Gala","Fuji"]' var='Kind'> <ul> <li><data:Kind/></li> </ul> </b:loop> </b:switch> </ul> </b:loop> <b:case value='Food'/> <b:loop values='["Meat","Vegetable"]' var='Food'> <ul> <li><data:Food/></li> </ul> </b:loop> <b:default/> <b:loop values='["Milk","Seafood","Juice","Banana"]' var='Unlisted'> <ul> <li><data:Unlisted/></li> </ul> </b:loop> </b:switch> </b:loop> </ul>
HTML Rendered Result
- Fruit
- Apple
- Gala
- Fuji
- Mango
- Orange
- Food
- Meat
- Vegetable
- Other
- Milk
- Seafood
- Juice
- Banana
In the example, we have three data in the loop, its ready to print the output. But, before that, he found a Switch and have different case for every data we have earlier. The case is processing main data and adds another data to the main. The process repeat until all Switch and Case fulfilled, so, now our data will look like rendered result above.
Other Tag
- <b:attr>
- <b:case>
- <b:class>
- <b:comment>
- <b:default>
- <b:defaultmarkup>
- <b:defaultmarkups>
- <b:eval>
- <b:else>
- <b:elseif>
- <b:if>
- <b:include>
- <b:includable>
- <b:loop>
- <b:message>
- <b:param>
- <b:section>
- <b:skin>
- <b:switch>
- <b:tag>
- <b:template-script>
- <b:template-skin>
- <b:widget>
- <b:widget-setting>
- <b:widget-settings>
- <b:with>
- <![CDATA[]]>
- <data:.../>