I
I
IgorRastarov2017-08-30 18:50:52
1C-Bitrix
IgorRastarov, 2017-08-30 18:50:52

How to display the subsection name in Bitrix?

Hello. Help, pliz

<?
$IBLOCK_ID    = 5;
$arFilter    = Array(
      'IBLOCK_ID'=>$IBLOCK_ID, 
      'ACTIVE'=>'Y',
    'DEPTH_LEVEL' => 3,
    );
$rsResult = CIBlockSection::GetTreeList($arFilter);

while($arResult = $rsResult->GetNext()){
   $arResult["ID"] = $hi;
}
?>
            <?foreach ($arResult["ID"] as $hi) {?>
         <?=$hi;?> //не работает
             <?}?>

Nothing is displayed on the screen. I don't use any components.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Emelyanov, 2017-08-30
@IgorRastarov

<?
$IBLOCK_ID    = 5;
$arFilter    = Array(
      'IBLOCK_ID'=>$IBLOCK_ID, 
      'ACTIVE'=>'Y',
    'DEPTH_LEVEL' => 3,
    );
$rsResult = CIBlockSection::GetTreeList($arFilter);

while($arSection = $rsResult->GetNext()){
   $arResult["ID"][] = $arSection;
}
?>
            <?foreach ($arResult["ID"] as $hi) {?>
         <? print_r($hi); ?> //не работает
             <?}?>

I
Ilya, 2017-08-30
@rpsv

Add somewhere above:
And it will become a little clearer. And so at a "look":
You assign an undeclared variable in a loop to each element:

while($arResult = $rsResult->GetNext()){
   $arResult["ID"] = $hi;
}

And then you try to use a scalar (which doesn't exist) as an iterator... What do you want from such code?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question