If you need to arrange items left and while performing a {foreach...}
loop, you can determine the module of the index property of each item during the iteration.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | {foreach $pages.data as $page} <div class="{if $page@index%2 == 1}right{else}left{/if}"> {$page.post_title} </div> {/foreach} {* index 0%2 = 0 index 1%2 = 1 index 2%2 = 0 index 3%2 = 1 index 4%2 = 0 index 5%2 = 1 *} |
{foreach $pages.data as $page} <div class="{if $page@index%2 == 1}right{else}left{/if}"> {$page.post_title} </div> {/foreach} {* index 0%2 = 0 index 1%2 = 1 index 2%2 = 0 index 3%2 = 1 index 4%2 = 0 index 5%2 = 1 *}
Create, customize, and publish mobile web applications using the Appcropolis Mobile Builder.
Get StartedWe offer 1,000's of mobile templates that are fully designed, coded, and ready to use. Learn more.
Download Free Templates
Not registered? Create an Account.
Lost your password? Click here to recover.