$sect = $SECTION_ID;
// выводит рекурсивно дерево разделов
function ShowSectionsTree($IBLOCK_ID, $SECTION_ID, $deep, $max_deep, $sect)
{
global $ID, $APPLICATION;
static $HTML;
static $sect;
$deep++;
$s_style ="style=\"padding-left:3px\"";
$rsS = GetIBlockSectionListWithCnt($IBLOCK_ID, $SECTION_ID, Array( "sort"=>"asc"));
while($arS = $rsS->GetNext())
{
$s_url = "/catalog/prod2/section.php?SECTION_ID=".$arS["ID"];
$str ="<tr valign=middle>";
for ($i=1;$i<$deep;$i++)
{
$str .= ($i<$deep-1) ? "<td><font class=smallBlueBold> </font></td>" : "<td valign=top><img height=13 src=/bitrix/templates/demo/images/right_down_arrow.gif width=17 border=0></td>";
}
$colspan = $max_deep - $deep;
if ($arS["ID"] == $sect):
$s_class = "class = smallOrangeBold";
else:
$s_class = "class = smallBlueBold";
endif;
$str.= sprintf("<td width=100%% colspan=%d><div class=\"smallBlueBold\" %s><a %s href=\"%s\">%s</a> (%d)</div></td></tr>",$colspan, $s_style, $s_class, $s_url, $arS["NAME"],$arS["ELEMENT_CNT"]);
$HTML .= $str;
ShowSectionsTree($IBLOCK_ID, $arS["ID"], $deep, $max_deep, $sect);
}
return $HTML;
}
|