<? if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();


if (!empty($arResult["ITEMS"])) {
 $arResult['MAIN']=[];

  foreach ($arResult["ITEMS"] as $key => &$arItem) {
    if (!empty($arItem["PREVIEW_PICTURE"]["ID"])) {
      $arItem["PICTURE"] = CFile::ResizeImageGet($arItem["PREVIEW_PICTURE"]["ID"], array('width' => 460, 'height' => 310), BX_RESIZE_IMAGE_PROPORTIONAL, true)["src"];
    }

    if (!empty($arItem["DISPLAY_PROPERTIES"]["DATE"]["VALUE"])) {
      $arItem["DATE"] = CIBlockFormatProperties::DateFormat($arParams["ACTIVE_DATE_FORMAT"], MakeTimeStamp($arItem["DISPLAY_PROPERTIES"]["DATE"]["VALUE"], CSite::GetDateFormat()));
    }




  }

}
//главная новость
$arResult['MAIN']=$arResult['ITEMS'][0];
unset($arResult['ITEMS'][0]);

$arResult['MAIN']['PREVIEW_PICTURE_MOB']=CFile::GetPath($arResult['MAIN']['PROPERTIES']['PREVIEW_PICTURE_MOB']['VALUE']);
//хештеги

$arResult['HASHTAGS']=[];
$arFilter = Array(
    "IBLOCK_ID"=>$arParams['IBLOCK_ID'],
    "ACTIVE"=>"Y",

);
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->GetNextElement()) {
    $arItem = $ob->GetFields();
    $arItem['PROPERTIES'] = $ob->GetProperties();
    if ($arItem['PROPERTIES']['HASHTAG']['VALUE']!="") {
        $arResult['HASHTAGS'][] = $arItem['PROPERTIES']['HASHTAG']['VALUE'];
    }



}
$arResult['HASHTAGS']=array_unique($arResult['HASHTAGS']);

//название, title, текст под h1
$arFilter = Array(
    "IBLOCK_ID"=>43,
    "ACTIVE"=>"Y",
    "ID"=>258
);
$arResult['TITLE']=[];
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->GetNextElement()) {
    $arItem = $ob->GetFields();
    $arItem['PROPERTIES'] = $ob->GetProperties();

    $arResult['BREAD_NAME'] = $arItem['PROPERTIES']['BREAD_NAME']['VALUE'];
    $arResult['TITLE'] = $arItem;




}

// поля подписка на рассылку
$IblockId=71;// инфоблок

$arFilter = Array(
    "IBLOCK_ID"=>$IblockId,
    "ACTIVE"=>"Y",
    "ID"=>458

);
$arSelect = Array("ID", "IBLOCK_ID", "NAME","PREVIEW_TEXT","PROPERTY_TITLE","PROPERTY_TAG","PROPERTY_BOOK");//IBLOCK_ID и ID

$res = CIBlockElement::GetList(Array(), $arFilter, false,array('nTopCount'=>1), $arSelect);
while($ob = $res->GetNextElement()) {
    $arItem = $ob->GetFields();

    $arResult['SUBSCRIBE-TITLE'] = $arItem['~PROPERTY_TITLE_VALUE']['TEXT'];
    $arResult['SUBSCRIBE-TEXT'] = $arItem['PREVIEW_TEXT'];
    $arResult['SUBSCRIBE-BOOK']= $arItem['PROPERTY_BOOK_VALUE'];





}






