GetList
CDBResult CIBlockSection::GetList( array arOrder = Array("SORT"=>"ASC"), array arFilter = Array(), bool bIncCnt = false );
Returns a filtered and sorted list of sections.
Parameters
Parameter | Description |
---|---|
arOrder |
Optional sort order. Array of the format Array(by1=>order1[,
by2=>order2 [, ..]]) where by is the field for
sorting. The field can have the following values:
|
arFilter | An array of the format Array("filter
field"=>"value" [, ...]) The filter field can be the following:
The "filter values" are a single value or an array. The default parameter value is an empty array. |
bIncCnt |
Specifies that the number of sections of the information block is to be
returned in the field ELEMENT_CNT. Optional. The default value is
false .
|
Return Values
Returns an instance of CDBResultRemarks
The sorting field left_margin (the so-called "through sorting") is calculated based on the field sort, nesting level and the parent level sort weight. The difference between sort and left_margin is that the sort is defined by the user to sort sections within a single parent section, while the left_margin is calculated automatically and is used for sorting within the whole information block.
See Also
Example
<? $arIBTYPE = CIBlockType::GetByIDLang($type, LANGUAGE_ID); if($arIBTYPE!==false) { // select only active sections from the information block $IBLOCK_ID, // having elements with properties "SRC" starting with "https://" $arFilter = Array('IBLOCK_ID'=>$IBLOCK_ID, 'GLOBAL_ACTIVE'=>'Y', 'PROPERTY'=>Array('SRC'=>'https://%')); $db_list = CIBlockSection::GetList(Array($by=>$order), $arFilter, true); $db_list->NavStart(20); echo $db_list->NavPrint($arIBTYPE["SECTION_NAME"]); while($ar_result = $db_list->GetNext()) { echo $ar_result['ID'].' '.$ar_result['NAME'].': '.$ar_result['ELEMENT_CNT'].'<br>'; } echo $db_list->NavPrint($arIBTYPE["SECTION_NAME"]); } ?>
© «Bitrix24», 2001-2024