Bitrix Site Manager

CMain::GetCurPageParam

string
CMain::GetCurPageParam(
  string add_params = "",
  array remove_params = array()
)

The method GetCurPageParam returns the path and name of the current page relative to the site root and optionally modifies (adds or removes) the URL parameters.

Note
If 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
add_params String containing parameters to be added to the returned string.
Optional. The default value is an empty string.
remove_params Array with parameters to be removed from the returned string.
Optional. The default value is an empty array.

See Also

Example



<?
// current page: /en/?id=3&s=5&d=34
$page = $APPLICATION->GetCurPageParam("id=45", array("id", "d")); 
// result: /en/index.php?id=45&s=5
?>
// sample links "Logout" and "Register"

<?if ($USER->IsAuthorized()):?>

 <a href="<?echo $APPLICATION->GetCurPageParam("logout=yes", array(
     "login",
     "logout",
     "register",
     "forgot_password",
     "change_password"));?>">Logout</a>

<?else:?>
 
 <a href="<?echo $APPLICATION->GetCurPageParam("register=yes", array(
     "login",
     "logout",
     "forgot_password",
     "change_password"));?>">Register</a>

<?endif;?>