Jump to content
Holiday Closure, Nov 26 & 27 ×

Guides

Loops

Standard PHP loop types are supported as HTML logic tags.

 

Foreach

{{foreach [expression]}}
	...
{{endforeach}}

Expression is anything PHP would support in a loop. The variables the loop defines are available within the body of the loop:

<ul>
  {{foreach $arrayOfItems as $id => $item}}
      <li>{$id}: {$item}</li>
  {{endforeach}}
</ul>

 

For

{{for [expression]}}
	...
{{endfor}}

For example:

<ul>
	{{for $i = 0; $i < count( $arrayOfItems ); $i++}}
		<li>{$i}</li>
	{{endfor}}
</ul>

 

Breaking and continuing

If you need to break or continue a loop, you can use the relevant PHP statement to do so. For example, using break:

{{foreach $arrayOfItems as $id => $item}}
	{{if $id > 15}}
		{{break;}}
	{{endif}}
{{endforeach}}

 


  Report Guide


×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy