A
A
Alexander Ivanov2016-02-29 16:04:07
1C-Bitrix
Alexander Ivanov, 2016-02-29 16:04:07

Can I prescribe additional array options for $APPLICATION->IncludeFile?

Can I write and output parameters besides Array("MODE"=>"html")?

<?
        $APPLICATION->IncludeFile(
          SITE_DIR."include/[name-shablon]/footer/file.php",
          Array(),
          Array("MODE"=>"html")
        );
        ?>

An example in the documentation:
https://dev.1c-bitrix.ru/api_help/main/reference/c...
<?
// включаемая область для раздела
$APPLICATION->IncludeFile($APPLICATION->GetCurDir()."sect_inc.php", Array(), Array(
    "MODE"      => "html",                                           // будет редактировать в веб-редакторе
    "NAME"      => "Редактирование включаемой области раздела",      // текст всплывающей подсказки на иконке
    "TEMPLATE"  => "section_include_template.php"                    // имя шаблона для нового файла
    ));
?>

I'm making the footer and header right now.
I'm trying to avoid dumping files. Those. if I create a bunch of infoblocks for various small elements, then there will be a bunch of small files.
I think to do so footer.php and everything in it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-02-29
@cimonlebedev

I am inserting files like this

<?$APPLICATION->IncludeComponent(
  "bitrix:main.include",
  "",
  Array(
    "AREA_FILE_SHOW" => "file",
    "PATH" => "/include/file.php"
  )
);?>

Another option is to create an HL infoblock and output data from it. Here is an API example for fetching data into an array
<? CModule::IncludeModule("highloadblock");

use Bitrix\Highloadblock as HL;
use Bitrix\Main\Entity;


if (CModule::IncludeModule('highloadblock')) { ?>

                <?
                $arHLBlock = Bitrix\Highloadblock\HighloadBlockTable::getById(2)->fetch(); //Здесь ID Инфоблока
                $obEntity = Bitrix\Highloadblock\HighloadBlockTable::compileEntity($arHLBlock);
                $strEntityDataClass = $obEntity->getDataClass();

                $resData = $strEntityDataClass::getList(array(
                    'select' => array('ID', "UF_SORT", "UF_LINK", "UF_LINK_ENG", "UF_IMG", "UF_IMG_ENG", "UF_ACTIVE"),//Поля созданные в HL инфоблоке
                    'filter' => array("UF_ACTIVE" => "1"), //Фильр по полю
                    'order' => array('UF_SORT' => 'ASC'), // Сортировка по полю
                    'limit' => 100,
                ));
                while ($arItem = $resData->Fetch()) {
                    //ВЫВОД ДАННЫХ
                }
                ?>
       
    <?
}

?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question