-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcomponent.php
More file actions
36 lines (31 loc) · 1.54 KB
/
Copy pathcomponent.php
File metadata and controls
36 lines (31 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
require($_SERVER["DOCUMENT_ROOT"]."/_include/functions.php");
CModule::IncludeModule("iblock");
$arFilter=array(
"IBLOCK_ID" => $arParams['IBLOCK_ID'],
);
$arResult=Array();
$arProj = CIBlockSection::GetList(array("SORT"=>"ASC"),$arFilter,false);
while($projRes = $arProj->GetNextElement())
{
$arFields = $projRes->GetFields();
$arResult[$arFields["ID"]]["NAME"] = $arFields["NAME"]; //список разделов
}
foreach($arResult as $key => $arSection){
$arProjElem = CIBlockElement::GetList(array(),array("SECTION_ID"=>$key),false); // список элементов конкретного раздела
$count=0;
while($projResElem = $arProjElem->GetNextElement())
{
$count++; // отвечает за количество элементов в разделе. Выводится в скобках рядом с название раздела
$arElemFields = $projResElem->GetFields();
$arSelFlds["NAME"] = $arElemFields["NAME"];
$arSelFlds["PREVIEW_TEXT"] = $arElemFields["PREVIEW_TEXT"];
$arSelFlds["DETAIL_PAGE_URL"] = $arElemFields["DETAIL_PAGE_URL"];
$arSelFlds["DETAIL_TEXT_SIZE"] = strlen($arElemFields["DETAIL_TEXT"]);
$arResult[$key]["ITEMS"][] = $arSelFlds;
}
$arResult[$key]['COUNT'] = $count;
}
$this->IncludeComponentTemplate();
?>