<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
global $APPLICATION;
$component = $this->__component;
if(is_object($component)) {
foreach($component->arResult as $key => $arItem) {
preg_match("/[0-9]+/", $arItem["LINK"], $matches); //выдергиваем ID из урла секции
$dbSection = CIBlockSection::GetByID($matches[0]); //спрашиваем, что за секция у нас
if($arSection = $dbSection->GetNext()) {
if(intval($arSection["PICTURE"]) > 0) {
$dbFile = CFile::GetByID(intval($arSection["PICTURE"]))->GetNext();
$component->arResult[$key]["PICTURE"] = array(
"ID" => $dbFile["ID"],
"SRC" => CFile::GetPath($dbFile["ID"]),
"HEIGHT" => $dbFile["HEIGHT"],
"WIDTH" => $dbFile["WIDTH"],
"DESCRIPTION" => $dbFile["DESCRIPTION"],
);
}
}
}
}
|