S
S
sdn1994tg2020-11-09 18:47:13
1C-Bitrix
sdn1994tg, 2020-11-09 18:47:13

How to display the value of a component property in 1C Bitrix?

Good afternoon! How to display the value of a component property in 1C Bitrix?

Slider output code component.php

<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
use Bitrix\Main\Loader;
  
if(!Loader::includeModule("iblock"))
{
  return;
}

$arSelect = Array("ID", "NAME", "PREVIEW_PICTURE", "PREVIEW_TEXT", "PROPERTY_".$arParams["PROPERTY_CODE"]);
$arFilter = Array("IBLOCK_ID" => IntVal($arParams["IBLOCK_ID"]), "ACTIVE"=>"Y", "PROPERTY_".$arParams["PROPERTY_CODE"]."_VALUE" => 'Да');
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($arFields = $res->GetNext())
{
  $arResult[] = $arFields;	
}

$this->includeComponentTemplate();


?>


template.php code

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


    
 			<div class="header__slider__wrapp">
            <div class="header__slider">
      <?foreach ($arResult as $item): ?>

      <?
        $file = CFile::ResizeImageGet($item["PREVIEW_PICTURE"], array('width' => 1194,'height' => 481), BX_RESIZE_IMAGE_EXACT, true);
        //pr($file);
      ?> 

 <?=htmlspecialcharsBack($arResult["PROPERTIES"]["TGURL_PAGE"]["VALUE"]["TEXT"])?>


            <div class="header__slide">
                <img src="<?=$file['src']?>" alt="slide1" class="header__slide__img">
                <div class="header__slide__content">
                  <div class="header__slide__content__flex">
                    <div class="header__slide__content__text">
                      <div class="header__slide__title"><?=$item['NAME']?></div>
                      <div class="header__slide__subtitle"><?=$item['PREVIEW_TEXT']?></div>
                    </div>
                    <a href="<?=$arItem["PROPERTIES"]["TGURL_PAGE"]["VALUE"]?>" class="header__slide__btn">Подробнее</a>
                  </div>
                </div>
              </div>
    <?endforeach;?>
</div>
<img src="bitrix/templates/raif/img/arrow.png" class="header__slider__next">
<img src="bitrix/templates/raif/img/arrow.png" class="header__slider__prev">

</div>
</div>
</div>


TGURL_PAGE property code

I can't figure out how to display the property value...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Grebenshchikov, 2020-11-09
@DrFaustin

So you rebuild arResult. Dump it and see if you have a properties array or not

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question