Skip to content

Instantly share code, notes, and snippets.

@Elvinz
Created November 18, 2019 12:17
Show Gist options
  • Save Elvinz/be5b63e80b2ddf5c01de859173b6ef35 to your computer and use it in GitHub Desktop.
Save Elvinz/be5b63e80b2ddf5c01de859173b6ef35 to your computer and use it in GitHub Desktop.
Вывод секций инфоблока
<?
$infoblock = 13; // Инфоблок с id 13
$rs_Section = CIBlockSection::GetList(array('left_margin' => 'asc'), array('IBLOCK_ID' => $infoblock));
while ( $ar_Section = $rs_Section->Fetch() )
{
$ar_Resu[] = array( // собираем массив того, что нам нужно
'ID' => $ar_Section['ID'], // id раздела
'NAME' => $ar_Section['NAME'], // имя раздела (что нас собственно интересует)
'IBLOCK_SECTION_ID' => $ar_Section['IBLOCK_SECTION_ID'],
'IBLOCK_SECTION_ID' => $ar_Section['IBLOCK_SECTION_ID'],
'LEFT_MARGIN' => $ar_Section['LEFT_MARGIN'],
'RIGHT_MARGIN' => $ar_Section['RIGHT_MARGIN'],
'DEPTH_LEVEL' => $ar_Section['DEPTH_LEVEL'],
);
echo '<pre>'; print_r($ar_Resu); '</pre>'; // смотрим, что у нас собралось в массив, и можно смело пользоваться именами
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment