Skip to content

Instantly share code, notes, and snippets.

@simsalabim
Created April 11, 2011 12:38
Show Gist options
  • Select an option

  • Save simsalabim/913442 to your computer and use it in GitHub Desktop.

Select an option

Save simsalabim/913442 to your computer and use it in GitHub Desktop.
Template to list UL/OL in columns
{* @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