CityDesk 2.0-Documentation
Fancy LoopsOrdinary loops simply repeat their body once for each article that matches the condition. For special effects, you can create loops with special behavior:
- Alternate styles for odd and even items, using {$ odd $} and {$ even $}. See Alternating Styles.
- Display alternative text when there are no items in the loop, using {$ else $}. See Alternate Text for Empty Loops.
- Display text between each item in a loop, using {$ between $}. See Text Between Items in Loops.
- Display text before and after the loop, but only if there are matching items, using {$ before $} and {$ after $}. SeeBefore and After in Loops.
The complete syntax is:
{$ forEach n var in (condition) sort-order $}
.... text which appears for each item ....
{$ between $}
.... text which appears between each two items ....
{$ odd $}
.... text which appears for every other item, including the first ....
{$ even $}
.... text which appears for every other item, starting with the second ....
{$ else $}
.... text which appears if there are no items matching condition ....
{$ before $}
.... text which appears before the loop, only if there are items matching condition ....
{$ after $}
.... text which appears after the loop, only if there are items matching condition ....
{$ next $}Each of these sections is optional.
©Copyright 2001-2003 Fog Creek Software, Inc. All Rights Reserved.