Bitrix Site Manager

Structure of compound components

Complex components are used to create site sections (forum, catalog etc.); they connect simple components to display information. In fact, complex components are controllers that manage simple components. The complex component takes an HTTP request, defines the page to be displayed, and connects the template of this page.

The following code shows an example of a complex component.

<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?><?

$arDefaultUrlTemplates404 = array(
   "list" => "index.php",
   "element" => "#ELEMENT_ID#.php"

$arDefaultVariableAliases404 = array();

$arDefaultVariableAliases = array();

$arComponentVariables = array("IBLOCK_ID", "ELEMENT_ID");

$arUrlTemplates = array();

if ($arParams["SEF_MODE"] == "Y")
   $arVariables = array();

    $arUrlTemplates = 
    $arVariableAliases = 

   $componentPage = CComponentEngine::ParseComponentPath(

   if (StrLen($componentPage) <= 0)
      $componentPage = "list";


   $SEF_FOLDER = $arParams["SEF_FOLDER"];
   $arVariables = array();

    $arVariableAliases = 
                                             $arVariableAliases, $arVariables);

   $componentPage = "";
   if (IntVal($arVariables["ELEMENT_ID"]) > 0)
      $componentPage = "element";
      $componentPage = "list";


$arResult = array(
   "URL_TEMPLATES" => $arUrlTemplates,
   "VARIABLES" => $arVariables,
   "ALIASES" => $arVariableAliases


First of all, the following arrays are defined:

The predefined input parameter SEF_MODE can be either or N. If $arParams["SEF_MODE"] is Y, the component functions in the human friendly mode, otherwise - not.

The predefined input parameter SEF_FOLDER is effective if only the component is in the human friendly mode. In this case, it contains the component working directory. The path can be virtual (i.e. it may not exist). For example, the above component resides in /fld/n.php and functions in the human friendly mode. Let SEF_FOLDER be /company/news/. In this case, the component will be available at /company/news/index.php, /company/news/25.php etc.

The following Methods are used to determine the correct page to display and to restore the real component variables from aliases.

In the human friendly mode, the component takes the path template ID and the HTTP request parameters, and determines the page to be displayed. Then, it passes the page name in the following call:


On its pages, the compound component activates simple components and passes required parameters to them. For example, the "element" page of the sample component template (/templates/.default/list.php) can be he following:

<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
      "IBLOCK_ID" => $arParams["IBLOCK_ID"],
      "ELEMENT_ID" => $arResult["VARIABLES"]["ELEMENT_ID"],
      "SECTION_ID" => $arResult["VARIABLES"]["SECTION_ID"],
      "CACHE_TIME" => $arParams["CACHE_TIME"],

The last parameter ($component) is an object containing the current component. This gives the component a chance to be notified that it is connected from within a compound component, and use the compound component resources etc.