Documentation

GetCurPage

string
 CMain::GetCurPage(
 bool get_index_page=null
)

The method is used to obtain the path and name of the current page relative to the site root. Non-static method.

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

Parameters

ParameterDescription Available from version
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
$page = $APPLICATION->GetCurPage(); // result - /en/index.php
?>


© «Bitrix24», 2001-2024