Return to Snippet

Revision: 42753
at March 10, 2011 04:15 by crypticsoft


Initial Code
<div class="bullet-text">
	{{assign var="cnt" value=$results|@count }}
	
	{{ math equation="cnt/3" cnt=$results|@count assign=divis }}
	Total Count: {{$cnt}}
	Divided by 3: {{$divis}}
	

	<ul class="col">
		{{section name=i loop=$results}}	
			<li>
			      <strong><a href="/search/{{$results[i]|urlencode}}">{{$results[i]|validate}}</a></strong>
			</li>
			{{if $smarty.section.i.iteration % $divis == 0}}
			</ul><ul class="col"> 			
			{{/if}}
		{{/section}}
	</ul>
	  
  </div>

Initial URL

                                

Initial Description
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.

Initial Title
Smarty Template : Multiple Column Loop

Initial Tags

                                

Initial Language
Smarty