V
V
vladzvezdin2019-05-07 11:05:56
1C-Bitrix
vladzvezdin, 2019-05-07 11:05:56

Why is the content of the content block in Bitrix displayed only after reloading the page or when changing the region?

<div class="first-right-block">
                <?$APPLICATION->IncludeComponent("bitrix:main.include", ".default",
                        array(
                            "COMPONENT_TEMPLATE" => ".default",
                            "PATH" => SITE_DIR."include/mainpage/comp_firstblock_btns.php",
                            "AREA_FILE_SHOW" => "file",
                            "AREA_FILE_SUFFIX" => "",
                            "AREA_FILE_RECURSIVE" => "Y",
                            "EDIT_TEMPLATE" => "standard.php"
                        ),
                        false
                    );?>
           </div>

and here is the file
<?if(!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();?>

<?
$rsGroups = CIBlockSection::GetList (
    Array("SORT"=>"ASC"),
  Array("IBLOCK_ID"=>"56", "ACTIVE" => "Y", "UF_CITY_BNTS" => $_COOKIE['current_region']),
 	false,
 	Array("IBLOCK_ID", "ID", "NAME", "UF_*")
);

if ($arGroup = $rsGroups->GetNext()){
    ?> <div class="right-btn-content">

    <?$dbBtns = CIBlockElement::GetList (
        Array("SORT"=>"ASC"),
        Array("IBLOCK_ID"=>"56", "ACTIVE" => "Y", "SECTION_ID " => $arGroup["ID"]),
        Array("IBLOCK_ID", "ID", "NAME", "PREVIEW_TEXT", "PROPERTY_LINK_BTN")

    );

    while ($arBtn = $dbBtns->GetNext()){?>
        <a href="<?=$arBtn["PROPERTY_LINK_BTN_VALUE"]?>" class="right-btn">
            <?=$arBtn["NAME"];?>
            <span><?=$arBtn["PREVIEW_TEXT"];?></span>
        </a>


    <?}?>
    </div>
<?}?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
php_raper, 2019-05-07
@php_raper

Check what is stored in cookies.
Your selection is based on the value
Array("IBLOCK_ID"=>"56", "ACTIVE" => "Y", "UF_CITY_BNTS" => $_COOKIE['current_region'])
Apparently, the cookie is not set by default.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question