@GoldSlide

Как в цикле обернуть элементы в тег?

Суть вопроса
Есть цикл вывода категорий / подкатегорий разделенное по уровням
<div class="content__production--link-list flex-block--col">
  <?
  if (0 < $arResult["SECTIONS_COUNT"])
  {
  ?>  <div class="flex-block--col"><?
			$intCurrentDepth = 1;
			$boolFirst = true;
            $boolFirstD = true;
			foreach ($arResult['SECTIONS'] as &$arSection){
				$this->AddEditAction($arSection['ID'], $arSection['EDIT_LINK'], $strSectionEdit);
				$this->AddDeleteAction($arSection['ID'], $arSection['DELETE_LINK'], $strSectionDelete, $arSectionDeleteParams);
				if ($arSection['RELATIVE_DEPTH_LEVEL'] == 1){?>
			  <a class="content__production--title-link" target="_self" href="<? echo $arSection["SECTION_PAGE_URL"]; ?>"><? echo $arSection["NAME"];?></a>
                <?  $boolFirstD = false;
                    $intCurrentDepth = $arSection['RELATIVE_DEPTH_LEVEL'];}
				if ($arSection['RELATIVE_DEPTH_LEVEL'] == 2){?>
                  <a class="content__production--title-link--md" target="_self" href="<? echo $arSection["SECTION_PAGE_URL"]; ?>"><? echo $arSection["NAME"];?></a>
               <?
				$intCurrentDepth = $arSection['RELATIVE_DEPTH_LEVEL'];
				$boolFirst = false;
                }elseif($arSection['RELATIVE_DEPTH_LEVEL'] == 3){?>
				<li class="lik"><a class="content__production--title-link--mdd sdf" target="_self" href="<? echo $arSection["SECTION_PAGE_URL"]; ?>">- <? echo $arSection["NAME"];?></a></li>
			<?	}
			}
			unset($arSection);
}
?></div>
</div>

в строчке :
elseif($arSection['RELATIVE_DEPTH_LEVEL'] == 3){?>
				<li class="lik"><a class="content__production--title-link--mdd sdf" target="_self" href="<? echo $arSection["SECTION_PAGE_URL"]; ?>">- <? echo $arSection["NAME"];?></a></li>
			<?	}

Получается мне нужно сделать что бы если RELATIVE_DEPTH_LEVEL == 3 то обернуть все элементы в ul и собственно закрыть его
ХЕЕЕЕЛП
  • Вопрос задан
  • 79 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы