v5Tutorial Complete Blogger Tutorials

Blogger <b:includable> Tag

Re-use one code section in several different places.
  • It can control a section of code which used in multiple times.
  • b:includable saves a lot of work.

HTML b:includable Syntax

Each Blogger b:includabe in your template has opening and closing tags.

<b:includable id='myText'>
  Your Content Here
</b:includable>
Inside b:widget tag, use b:includable

HTML b:include Syntax

Use b:include tag to display content of b:includable tag.

<b:include name='myText'/>
Inside b:includable tag, use b:include.
Use b:includable tag id as b:include tag name.

Usage of b:includable Tag

Go to Template > Edit HTML.

Blogger Section: new

<html>
<head>
<title><data:blog.pageTitle/></title>
<b:skin/>
</head>

<body>
<b:section id='new'>
<b:widget id='HTML1' type='HTML' title="We Love v5">
  <b:includable id='main'>
  <data:title/> <b:include name='myText'/>
  </b:includable>

  <b:includable id='myText'>
  <b>Blogger</b>
  </b:includable>

</b:widget>
</b:section>
</body>
</html>
We Love v5 Blogger
Every widget must have a b:includable id='main' which contain the entire widget data.
Use b:includable and b:include tag in the same widget.

Control b:includable Tag

Configer b:includable tag with attributes.

<b:includable id='myData' var='thiswidget'>
  <img src='my-image.gif'/>
</b:includable>

This b:includable render a image by using b:include name myData. With var thiswidget referencing data within this section.

HTML b:includable Attributes

Attribute Values Description
id name Required. A unique identifier made up of letters and numbers. Each widget must have one includable with id='main'.
var name Optional. An identifier made up of letters and numbers, for referencing data within this section.

HTML b:include Attributes

Attribute Values Description
name name Required. A unique identifier made up of letters and numbers. Each widget must have one includable with id='main'.
data name Optional. An expression or piece of data to pass on to the includable section. This will become the value of the var attribute in the includable.
cond name Optional. An expression which causes the include to only execute when its result is true. This is the same as the cond attribute on a b:if.

Related Post

Java Scripts