string path,
 array params = array(),
 array function_params = array()

The method is the main function you use to include any files within the page body, prologue or epilogue. It is the only method that can be used to include components. The visual aspect of the included file represents the include area. Non-static method.


path Path to included file.

If the parameter contains the path relative to the site root, the method includes this file unconditionally. If the file cannot be found and the button "Show included areas" is checked, the frame-placeholder contains the blue button linked to the page allowing to create a new file in the folder specified in the parameter path.

If this parameter contains path relative to the included file, the system will deem this file as a component and will show the edit button in the edit mode.

If the parameter specifies the path to the main file of the component, the method attempts to find and include the file using the following rules:
  1. First, the file will be seached in the folder
    /bitrix/templates/current site template ID/path
  2. If the file is not found, the method tries the folder
  3. If the file is still not found, the method attempts to locate it in the module installation location:
    /bitrix/modules/module ID/install/templates/path,
    where module ID - is the first subfolder of the path
params Array of parameters to be passed to the included file. Array has the following format:
The include file initialises variables with names taken from the array keys; the variables values are the corresponding values of the array. This operation is performed using the standard extract(params) PHP function.
function_params Array with the parameters for the method. The following keys allowed:
  • SHOW_BORDER - specifies to show or hide the design frame and buttons. The following values are permitted:
    • true - show frame if the "Show includes areas" button is checked (default)
    • false - hide frame.
  • NAME - the Edit button tooltip text;
  • LANG - two-character identifier of the language that should be used to edit the file in the administrative section (current site language by default);
  • BACK_URL - page to which the user should be returned after the editing is completed. By default, the current page in the public section.
  • WORKFLOW - specifies the included file is a part of the workflow. The following values are possible:
    • true - the Edit link points to the Workflow module;
    • false - the Edit link points to the Site Explorer module (default).
  • MODE - editing mode. The following values are possible:
    • text - edit file as text (link to edit the file in plain text mode);
    • html - edit file as HTML (link to web editor)(default);
    • php - edit file as PHP (link to edit the source code of the file). 
  • TEMPLATE - if the path parameters specifies the absolute path to a missing file, this entry of the array should contain the name of the template file which is used to create a new file (by default, the method takes the first template according to their sort weight specified in the file: /bitrix/templates/current site template ID/page_templates/.content.php)

See Also

Example of including a component on the page

// the component displaying the information block contents 
$APPLICATION->IncludeFile("iblock/catalog/element.php", Array(
    "IBLOCK_TYPE"       => "catalog",                          // Type of information block
    "IBLOCK_ID"         => "21",                               // information block
    "ELEMENT_ID"        => $_REQUEST["ID"],                    // element ID
    "SECTION_URL"       => "/catalog/phone/section.php?",      // URL to the page with the section contents
    "LINK_IBLOCK_TYPE"  => "catalog",                          // type of information block whose elements are linked to the current one
    "LINK_IBLOCK_ID"    => "22",                               // ID of information block whose elements are linked to the current one
    "LINK_PROPERTY_SID" => "PHONE_ID",                         // property with link
    "LINK_ELEMENTS_URL" => "/catalog/accessory/byphone.php?",  // URL of the page displaying the link of linked elements
    "arrFIELD_CODE" => Array(                                  // Fields
    "arrPROPERTY_CODE" => Array(                               // Properties
    "CACHE_TIME"        => "3600",                              // Cache time (sec.)

Example of including a file in the site epilogue.

// included area for the section
$APPLICATION->IncludeFile($APPLICATION->GetCurDir()."sect_inc.php", Array(), Array(
    "MODE"      => "html",                                           // use html editor
    "NAME"      => "Edit the section included area",      // tooltip text on a popup icon
    "TEMPLATE"  => "section_include_template.php"                    // template name for the new file

© «Bitrix24», 2001-2023