View Single Post
  #6  
Old 03-17-2011, 12:43 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default Re: Help with Smarty

Here is the solution without using any web resources. I tried to make it as simple as I could.

Code:
{assign var="columns" value=3} {assign var="i" value=0} {assign var="totalmanufacturers" value=$manufacturers|@count} {if $manufacturers} {if $columns gt 0} {assign var="rowloop" value=$totalmanufacturers/$columns} {assign var="restloop" value=$totalmanufacturers%$columns} <table> {section name=rows loop=$rowloop} <tr> {section name=rowname loop=$columns} <td>{$manufacturers[$i].name}</td> {assign var="i" value=$i+1} {/section} </tr> <tr> {assign var="i" value=$i-$columns} {section name=rowproducts loop=$columns} <td>{$manufacturers[$i].products}</td> {assign var="i" value=$i+1} {/section} </tr> {/section} <tr> {section name=rowname loop=$restloop} <td>{$manufacturers[$i].name}</td> {assign var="i" value=$i+1} {/section} </tr> <tr> {assign var="i" value=$i-$restloop} {section name=rowproducts loop=$restloop} <td>{$manufacturers[$i].products}</td> {assign var="i" value=$i+1} {/section} </tr> </table> {else} The number of columns must be greater than 0 {/if} {else} There are no manufacturers. Please create them. {/if}
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote