Topics

cycle function

This isn't Exponent specific, but if you haven't visited the Smarty Docs yet, you should really know about it. Here's a sample piece of code:

{foreach name=items from=$items item=item}          
   <div class="item {cycle values="column-left,column-right"}">
     <h2>{$item->title}</h2>      
     <div class="bodycopy">{$item->body}</div>   
   </div>
{/foreach}        
{clear}

The "cycle values" expression lets you tell Exponent, through the Templating Engine, to output alternating values for your div classes in this case. This can be used with table rows and other HTML.

Loading Help