Created
April 11, 2011 12:38
-
-
Save simsalabim/913442 to your computer and use it in GitHub Desktop.
Template to list UL/OL in columns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {* @param Array $items collection of items to list *} | |
| {* @param int $columnsCount quantity of colums in list representation *} | |
| <ul style="white-space: nowrap;"> | |
| {assign var=itemsCount value=$items|@count} | |
| {assign var=inColumn value=$itemsCount/$columnsCount|@ceil} | |
| {foreach from=$items item=item key=key} | |
| {if $key%$inColumn==0} | |
| <ul style="width:250px;display:inline-block;vertical-align:top;"> | |
| {/if} | |
| <li> | |
| <nobr>{$item}</nobr> | |
| </li> | |
| {if $key%$inColumn==$inColumn-1} | |
| </ul> | |
| {/if} | |
| {/foreach} | |
| </ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment