Bitrix Site Manager

CComponentEngine::ParseComponentPath

bool
ParseComponentPath(
 string folder404 ,
 array arUrlTemplates ,
 array & arVariables [,
 string requestURL]
);

This method helps handle SEF paths in compound components.

The method takes the component working folder, an array of path templates and the current requested page, and returns the compound component path code. Also the method restores variables that were assigned in the path.

Parameters

Parameter Description
folder404 The component working folder in SEF mode. This path is passed in $arParams["SEF_FOLDER"].
arUrlTemplates An array of component path templates in SEF mode. This array is hard-coded in the component kernel and can be overridden by $arParams["SEF_URL_TEMPLATES"].
arVariables A variable in which the restored variables for the specified path are returned.
requestURL The requested path. By default - $APPLICATION->GetCurPage().

Return Values

Returns the template code, or an empty string otherwise.

Example

// if the path template array is
$arUrlTemplates = array(
	"list" => "index.php",
	"element" => "#IBLOCK_ID#/#ELEMENT_ID#.php?SID=#SECTION_ID#"
);
// and SEF_FOLDER is /company/news/
// and the requested address is /company/news/15/7653.php?SID=28

// then after calling ParseComponentPath:
$arVariables = array();
$page = 
    CComponentEngine::ParseComponentPath($arParams["SEF_FOLDER"], 
                                         $arUrlTemplates, $arVariables);

// the variable $page will contain "element"
// (the code of the corresponding template)
// and $arVariables will be
$arVariables = array(
	"IBLOCK_ID" => 15,
	"ELEMENT_ID" => 7653
)

See Also

  • Complex component structure
  • Input variable aliases
  • CComponentEngine::MakeComponentUrlTemplates