Smarty Code Snippets

26 November, 2012   

Example code for smarty Loop for x to y with no array


Take array and create multiple columns, define divisible by value ($divis) from total results then use modulus within the loop. This example shows multiple columns for unordered list items.

09 July, 2011   

How to sort array in smarty template? Create sort modifier file and save it in smarty / plugins with modifier.sortby.php name use this modifier in smarty template like... {foreach item=item key=key from=$users|@sortby:"firstname"} {$}-{$item.firstname} {/foreach}

Makes it extremely easy to integrate code igniter and smarty as well as provide layout capabilites.