View Single Post
  #2  
Old 05-26-2008, 06:29 AM
 
xim xim is offline
 

X-Cart team
  
Join Date: Nov 2004
Posts: 677
 

Default Re: Display Sub Categories in 2 or 3 column + Pic

Try to use the following code in the template where the $subcategories array is defined:

Code:
{assign var="cell_counter" value="0"} {assign var="subcat_per_row" value="3"} <table width="100%" cellspacing="5"> {foreach from=$subcategories item=subcat} {math equation="x+1" x=$cell_counter assign="cell_counter"} {if $cell_counter eq "1"}<tr>{/if} <td><a href="home.php?cat={$subcat.categoryid}"><img src="{$subcat.categoryid|func_get_image_url:C|default:"image.php?id=`$subcat.categoryid`&type=C"}" alt="{$subcat.category|escape}" style="padding-right: 5px;" align="left"/>{$subcat.category}</a></td> {if $cell_counter eq $subcat_per_row} </tr> {assign var="cell_counter" value="0"} {/if} {/foreach} {if $cell_counter gt 0} {section loop=$subcat_per_row name=cc start=$cell_counter} <td>&nbsp;</td> {/section} </tr> {/if} </table>

Also, I'd recommend you to move your category images to the file system. You can perform it under admin area on the "Images location" page.
__________________
Sincerely yours, Max Vydrin
Reply With Quote