G
G
Grione2021-01-25 13:57:39
1C-Bitrix
Grione, 2021-01-25 13:57:39

How to get infoblock element properties (Bitrix)?

There is a custom slider. It outputs an image. But I need to display more properties of this slide (title, description). I created properties for the infoblock, but I can't figure out how to display it.
When I do a dump there are no properties.

template.php

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

<div class="production-slider-wrapper">

    <ul class="production-slider">

        <?foreach ($arResult as $item): ?>

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

        <li class="production-slide">
            <div class="production-figure">
                <img class="production-slide__image" src="<?= $file['src'] ?>" alt="">
            </div>
            <div class="production-slide-text">
                <? print_r($item)?>
                <h3 class="production-slide__title"><?= $item['TITLE']?></h3>
                <p class="production-slide__description"><?= $item['DESCRIPTION']?></p>
                
            </div>
        </li>

        <?endforeach;?>

    </ul>
</div>

And here is the output <? print_r($item)?>:
Array ( [ID] => 2154 [~ID] => 2154 [NAME] => Слайдер 1 [~NAME] => Слайдер 1 [PREVIEW_PICTURE] => 9539 [~PREVIEW_PICTURE] => 9539 [DETAIL_PAGE_URL] => /slider/detail.php?ID=2154 [~DETAIL_PAGE_URL] => /slider/detail.php?ID=2154 [LANG_DIR] => / [~LANG_DIR] => / [CODE] => [~CODE] => [EXTERNAL_ID] => 2154 [~EXTERNAL_ID] => 2154 [IBLOCK_SECTION_ID] => [~IBLOCK_SECTION_ID] => [IBLOCK_TYPE_ID] => slider [~IBLOCK_TYPE_ID] => slider [IBLOCK_ID] => 27 [~IBLOCK_ID] => 27 [IBLOCK_CODE] => [~IBLOCK_CODE] => [IBLOCK_EXTERNAL_ID] => [~IBLOCK_EXTERNAL_ID] => [LID] => s1 [~LID] => s1 )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor Zhivagin, 2017-06-20
@string15

navToggle.addEventListener('click', function() {
      if (navMain.classList.contains('main-nav--closed')) {
        navMain.classList.remove('main-nav--closed');
        navMain.classList.add('main-nav--opened');
      } else {
        navMain.classList.add('main-nav--closed');
        navMain.classList.remove('main-nav--opened');
      }

At the end, I didn’t close the click - you need });
UPD - at the very end, instead of "()", put ")"
UPD 2 Important - do you understand the text of the error? Something like this: "on line 112, something is wrong with the closing bracket"
So that there are no more such problems, you can put an IDE. WebStorm breaks in a second and solves this problem perfectly

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question