V
V
Vadim Timoshenko2020-03-02 15:48:06
1C-Bitrix
Vadim Timoshenko, 2020-03-02 15:48:06

How to pass data to the component template?

I want to pass data, menu title to the bitrix:menu component template .
Is it possible to do this inside $APPLICATION->IncludeComponent ?

Something like:

<?$APPLICATION->IncludeComponent(
    "bitrix:menu",
    "",
    Array(
      ...
      "MENU_TITLE" => "О гостинице"
      ...
    ));?>


Please tell me how to do this, and how to display inside the template?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail, 2020-03-02
@PbI6A_KuT

in the component template, add the file .parameters.php
to this file, paste:

$arTemplateParameters = [
    "MENU_TITLE" => [
        "NAME" => "Заголовок"
        "TYPE" => "STRING",
    ],
];

after that, the "Title" field will appear in the component settings, and in the template you can get the filled field through $arParams["MENU_TITLE"]

A
Alexander, 2020-03-02
Madzhugin @Suntechnic

See the contents of $arParams. It will be like this:

Array(
      ...
      "MENU_TITLE" => "О гостинице"
      "~MENU_TITLE" => "О гостинице"
      ...
    )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question