Documentation

IncludeComponent

mixed
 IncludeComponent(
 string componentName,
 string componentTemplate,
 array arParams=array(),
 object parentComponent=null,
 array arFunctionParams=array()
 );

The method includes component 2.0. Non-static method.

Parameters

ParameterDescription
componentNameComponent name. For example: "bitrix:news.detail".
componentTemplateName of component template. If empty, the ".default" is implied.
arParamsArray of input parameters for component.
parentComponentObject of complex parent component, if the component is included from the complex component template. The $component variable is specified in the complex component template. This variable contains an object of this complex component.
arFunctionParamsArray containing additional component parameters:
"HIDE_ICONS"=>"Y" - do not show the component settings panel in the edit/design mode;
"ACTIVE_COMPONENT"=>"N" - disable component (component code is not included).
returnResultDefault value - false. Allows getting component's arResult.

Returned value

Returns code of component.

Example

// Include a folder component with the "by default" template on a public site page
$APPLICATION->IncludeComponent(
    "bitrix:catalog",
    "",
    Array(
        "SEF_MODE" => "N",
        "IBLOCK_TYPE_ID" => "catalog",
        "ACTION_VARIABLE" => "action",
        "CACHE_TIME" => 1*24*60*60,
        "BASKET_PAGE_TEMPLATE" => "/personal/basket.php",
    )
);

// Include photo details component with the "by default" template in the template of 
// "photo gallery" complex component 
$APPLICATION->IncludeComponent(
    "bitrix:photo.detail",
    "",
    Array(
         "IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"],
         "IBLOCK_ID" => $arParams["IBLOCK_ID"],
         "ELEMENT_ID" => $arResult["VARIABLES"]["ELEMENT_ID"],
         "ELEMENT_CODE" => $arResult["VARIABLES"]["ELEMENT_CODE"],
    ),
    $component
);


© «Bitrix24», 2001-2022
Up