Главная 
 Каталог 
 Склад 
 Акции 
 О компании 
 Наши клиенты 
 Как мы работаем 
 Новости 
 Контакты 

Главная

<?
/*************************************************************************************************
Component "Two level groups structure (with element count for each group)".

This component is intended for displaying the list of catalog groups with nested sub levels with element count for each level. Mainly used on the catalog main page.

Sample of usage:

$APPLICATION->IncludeFile("iblock/catalog/sections_top_2.php", Array(
"IBLOCK_TYPE" => "catalog",
"IBLOCK_ID" => "22",
"SECTION_SORT_FIELD" => "sort",
"SECTION_SORT_ORDER" => "asc",
"SECTION_URL" => "/catalog/accessory/section.php?",
"CACHE_TIME" => "3600",
));

Parameters:

IBLOCK_TYPE - Information block type
IBLOCK_ID - Information block ID
SECTION_SORT_FIELD - by which field the groups will be sorted, can be used the following values:

sort - by sorting index
timestamp_x - by modification date
name - by group title
id - by group ID
depth_level - nesting lebvel of the group

SECTION_SORT_ORDER - Sorting order for information block groups, following values can be used:

asc - in ascending order
desc - in descending order

SECTION_URL - URL to the page with the group contents
CACHE_TIME - (sec.) time to cache the values selected from database

*************************************************************************************************/

global $USER, $APPLICATION;
if (CModule::IncludeModule("iblock")):

IncludeTemplateLangFile(__FILE__);

$bDisplayPanel = ($DISPLAY_PANEL == "Y") ? True : False;
if ($bDisplayPanel)
CIBlock::ShowPanel($IBLOCK_ID, 0, 0, $IBLOCK_TYPE);

/*************************************************************************
Work with cache
*************************************************************************/

$CACHE_ID = __FILE__.md5(serialize($arParams).serialize($arrFilter).$USER->GetGroups());
$obCache = new CPHPCache;
if($obCache->StartDataCache($CACHE_TIME, $CACHE_ID, "/")):

if ($rsSections_top=GetIBlockSectionListWithCnt($IBLOCK_ID, 0, Array($SECTION_SORT_FIELD=>$SECTION_SORT_ORDER, "ID" => "DESC"), false, array("DEPTH_LEVEL" => 1))) :

/****************************************************************
HTML form
****************************************************************/
?>

<table border="0" cellspacing="0" cellpadding="0" width="600">


<?

$counter=0;
$col=5;

while ($arSection_top=$rsSections_top->GetNext()) :
$URL = $SECTION_URL."SECTION_ID=".$arSection_top["ID"];

if ($counter%$col==0)
print "<tr>";

$counter++;



?>

<td width="120" height="45" valign="middle" align="center" background="/bitrix/templates/main/images/b.gif">
<a class="indexmenu" href="<?=$URL?>"><b><?=$arSection_top["NAME"]?></b></a>
</td>

<?
if ($counter%$col==0)
print "</tr>";
endwhile;

?>



</table>
<?
endif;
$obCache->EndDataCache();
endif;
endif;
?>
Area title...
Area text...