E
E
Eugene M2019-06-10 19:40:27
1C-Bitrix
Eugene M, 2019-06-10 19:40:27

How to display a custom field?

In general, everything works except that the property is displayed only when it is filled, that is, this construction <? if ($arResult["UF_HEADER_PHOTO_1"]) { ?> does not work, tell me how to write it correctly?!

<? if ($arResult["UF_HEADER_PHOTO_1"]) { ?>
    <?
    $ar_result = CIBlockSection::GetList(Array("SORT" => "ASC"), Array("IBLOCK_ID" => "71", "ID" => $arCurSection["ID"]), false, Array("UF_HEADER_PHOTO_1"));
    if ($res = $ar_result->GetNext()) {
        echo "<h2>" . $res["UF_HEADER_PHOTO_1"] . "</h2>";
    }
    ?>
<? } ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yaroslav Alexandrov, 2019-06-11
@alexyarik

<?if (strlen($arResult["UF_HEADER_PHOTO_1"])>0):?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question