Site is Under Maintenance
Please come back again in...
00 Days
00 Hours
00 Minutes
00 Seconds
Wellcome To My Blog Dulpan Adi Saragih. Thanks For Visiting My Blog New! Join Disscusion Now!

b:loop

A loop is a sequence of instruction s that is continually repeated until a certain condition is reached. Typically, a certain process is done, such as getting an item of data and changing it, and then some condition is checked such as whether a counter has reached a prescribed number. In the Blogger Language , a loop is implemented using the tag <b:loop>. Most commonly used for printing out each post in a list of posts for a given page, or each comment, or each label, etc.

<b:loop> Syntax and Attributes

BLOGGER XML LANGUAGE

<b:loop index='STRING'        
        values='ARRAY'
        var='STRING'
        reverse='BOOLEAN'>
    <!-- Repeat -->
</b:loop>
  • values attribute value can be expression resulting an Array.
  • index with string value will give index number of each result starting from 0.
  • reverse mean to display result from backward.
  • reverse is not necessary. The default is not visible which mean 'false'.

<b:loop> Example

POST ARTICLE

<b:loop index='i' values='data:posts' var='post'>
  <div>
    <h3>
      <b:eval expr='data:i + 1' />. <data:post.title />
    </h3>
    <div>
      <data:post.body />
    </div>
  </div>
</b:loop>
<b:if> 

Index with the name i, transform into data: and got <b:eval> tag, will evaluate with expression expr:'data:i + 1'. This will evaluate starting value 0 + 1.

HTML RENDERED RESULT

1. This is Post Title

WITH STRING

<ul>
<b:loop values='["Bar","Baz","Qux"]' var='foo' >
    <li>
        <data:foo/>
    </li>
</b:loop>
</ul>

The data Bar, Baz, and Qux will be printed as result by calling <data:foo/>

Other Tag

Rate this article

Getting Info...

About Post Author

Cookies Consent

This website uses cookies to ensure you get the best experience on our website.

Cookies Policy

We employ the use of cookies. By accessing Plus UI, you agreed to use cookies in agreement with the Plus UI's Privacy Policy.

Most interactive websites use cookies to let us retrieve the user’s details for each visit. Cookies are used by our website to enable the functionality of certain areas to make it easier for people visiting our website. Some of our affiliate/advertising partners may also use cookies.