У меня есть result_modifier.php
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
$arSections = CIBlockSection::GetList(Array("SORT" => "DESK", 'left_margin' => 'ASC'), Array("IBLOCK_ID" => "13", "ACTIVE"=>"Y"));
while($section = $arSections->GetNext()) {
$sectionsList[$section["ID"]]["ID"] = $section["ID"];
$sectionsList[$section["ID"]]["CODE"] = $section["CODE"];
$sectionsList[$section["ID"]]["NAME"] = $section["NAME"];
$sectionsList[$section["ID"]]["ITEMS"] = Array();
$rsSection["ID"][] = $section;
}
$arElements = CIBlockElement::GetList(
Array("SORT"=>"ASC", 'ID' => 'desc'),
Array("IBLOCK_ID" => "13","ACTIVE"=>"Y"),
false,
false,
Array("ID", "CODE", "NAME", "IBLOCK_SECTION_ID")
);
while($element = $arElements->GetNextElement()) {
$arFields = $element->GetFields();
$sectionsList[$arFields["IBLOCK_SECTION_ID"]]["ITEMS"][] = Array("ID" => $arFields["ID"], "CODE" => $arFields["CODE"], "NAME" => $arFields["NAME"]);
}
foreach ($rsSection["ID"] as $section) {
var_dump($section["NAME"]);
}
Все работает. Когда пытаюсь переместить в template.php
foreach ($rsSection["ID"] as $section) {
var_dump($section["NAME"]);
}
Перестает работать. Что не так?