Documentation

GetCurUri

string
CMain::GetCurUri(
 string add_params = "", 
 string get_index_page=null
)

Then method is used to obtain the path and name of the current page relative to the site root, with the parameters passed on URL. Non-static method.

If the file of the current page is not defined explicitly, the index page of a folder is determined using the algorithm of the GetDirIndex function.

Parameters

ParameterDescription Available from version
add_params String containing parameters to be added to the returned string.
Optional parameter. empty by default.
get_index_pageThis parameter specifies if the path that ends with "index.php" must be returned for the index page of the section. If true, the path with "index.php" is returned, otherwise - the path ending with "/" is returned. The default value is null.

If get_index_page equals to:

  • null, behaviour is defined by the BX_DISABLE_INDEX_PAGE constant. If the constant value is true, the parameter value by default is get_index_page=false.
  • false, index.php will be deleted from the returned page url (substring from '0' position to the first encountered "/index.php" is returned)
  • true, url is returned without changes

See Also

Examples of use

<?
// current page: /en/?id=3&s=5
$uri = $APPLICATION->GetCurUri("r=1&t=2"); // result - /en/index.php?id=3&s=5&r=1&t=2
?>


© «Bitrix24», 2001-2024
Up