{* $Id: categories.tpl,v 1.26 2005/11/17 06:55:37 max Exp $ *}
{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{include file="modules/Fancy_Categories/categories.tpl"}
{assign var="fc_cellpadding" value="0"}
{else}
{* keeping this option helps for troubleshooting a live site *}
{if $config.General.root_categories eq "Y"}
{foreach from=$categories item=c}
 |
|
{/foreach}
{else}
{* if you uncheck the checkbox under general settings: show all categories with all their subcategories *}
{php}
global $smarty,$sql_tbl,$categories;
//$search_categories = $smarty->get_template_vars("allcategories");
$r=0;
foreach($categories as $cats)
{
$arr[$r]['id']=$cats['categoryid'];
$arr[$r]['name']=$cats['category'];
$mq=mysql_query("SELECT categoryid,category FROM $sql_tbl[categories]
WHERE parentid=$cats[categoryid]
AND avail='Y'");
$i=0;
while($data=mysql_fetch_assoc($mq))
{
$arr[$r]['child'][$i]['id']=$data['categoryid'];
$arr[$r]['child'][$i]['name']=$data['category'];
$i++;
$num++;
}
$r++;
}
$smarty->assign("my_cats",$arr);
{/php}
{foreach from=$my_cats item=c}
 |
|
{foreach from=$c.child item=s}
|
{$s.name} |
{/foreach}
{/foreach}
{/if}
{/if}
{/capture}
{ include file="menu.tpl" menu_content=$smarty.capture.menu cellpadding=$fc_cellpadding}