string MakePathFromTemplate( string template , array arParams );
The method replaces #SITE_DIR#, #SITE#, #SERVER_NAME# in template with values of the system-wide constants SITE_DIR, SITE_ID, SITE_SERVER_NAME, respectively.
Also the method replaces all substrings like "#arParams key#" with the corresponding values according to arParams.
Parameter | Description |
---|---|
template | The path template, can contain substrings "#.....#". |
arParams | An array of replacement rules: array( "key1" => "value 1", "key2" => "value 2", * * * )Defines replacements to be performed in template. |
Returns a string with substrings replaced according to arParams.
// path temlpate from input parameters
$arParams["SECTION_PAGE_TEMPLATE2"] = "/#IBLOCK_ID#/#SECTION_ID#.php?s=#SITE#"; // component computed the following values: $IBLOCK_ID = 3; $SECTION_ID = 982; // create a path using the template and // the computed values $pagePath = CComponentEngine::MakePathFromTemplate( $arParams["SECTION_PAGE_TEMPLATE2"], array( "IBLOCK_ID" => $IBLOCK_ID, "SECTION_ID" => $SECTION_ID ) ); // Now $pagePath contains: $pagePath = "/3/982.php?s=en";
© 2001-2007 Bitrix | Bitrix Site Manager |