Skip to content

Instantly share code, notes, and snippets.

@Pum-purum
Created December 7, 2017 07:35
Show Gist options
  • Save Pum-purum/a85609fd7ca46887c6ad4f905b8add11 to your computer and use it in GitHub Desktop.
Save Pum-purum/a85609fd7ca46887c6ad4f905b8add11 to your computer and use it in GitHub Desktop.
Меню из элементов инфоблока Битрикс
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
global $APPLICATION;
if (CModule::IncludeModule("iblock")) {
$IBLOCK_ID = 32; // указываем из акого инфоблока берем элементы
$arOrder = Array("SORT" => "ASC"); // сортируем по свойству SORT по возрастанию
$arSelect = Array("ID", "NAME", "IBLOCK_ID", "DETAIL_PAGE_URL");
$arFilter = Array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE" => "Y");
$res = CIBlockElement::GetList($arOrder, $arFilter, false, false, $arSelect);
while ($ob = $res->GetNextElement()) {
$arFields = $ob->GetFields();
// начинаем наполнять массив aMenuLinksExt нужными данными
$aMenuLinksExt[] = Array(
$arFields['NAME'],
$arFields['DETAIL_PAGE_URL'],
Array(),
Array(),
""
);
}
}
$aMenuLinks = array_merge($aMenuLinksExt, $aMenuLinks);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment