Control Structures
As in other languages, control structures in Automad are statements that dynamically determine the flow of an application or website based on evaluating content or variables. Automad knows four different statements to control the flow of the application: for, foreach, if and with. In contrast to function calls, control structures are always wrapping blocks of code and can therefore also be nested.
Usage
Control structure have the following syntax:
<@ foreach in filelist {options} @>
<# Code to be executed for every file goes here. #>
<@ end @>
Some statements can also have an else
block:
<@ foreach in pagelist @>
<# Code block to be executed for every page. #>
<@ else @>
<# Code to be executed in case the pagelist is empty. #>
<@ end @>