The URLHelper class provides several utility functions (as class methods) to ease the transition from using session data to URL parameters.
The most important method is URLHelper::getLink(), which appends a number of additional parameters to a given URL. The parameters can be set using the addLinkParam() or bindLinkParam() methods.
◆ addLinkParam()
static addLinkParam |
( |
|
$name, |
|
|
|
$value |
|
) |
| |
|
static |
Add a new link parameter. If a parameter with this name already exists, its value will be replaced with the new one. All link parameters will be included in the link returned by getLink().
- Parameters
-
string | $name | parameter name |
mixed | $value | parameter value |
◆ bindLinkParam()
static bindLinkParam |
( |
|
$name, |
|
|
& |
$var |
|
) |
| |
|
static |
Bind a new link parameter to a variable. If a parameter with this name already exists, its value will re replaced with the binding.
This method differs from addLinkParam() in two respects:
- The bound variable is initialized with the parameter value in the current request.
- The parameter value is the value of the bound variable at the time getLink() is called.
- Parameters
-
string | $name | parameter name |
mixed | $var | variable to bind |
◆ getLink()
static getLink |
( |
|
$url = '' , |
|
|
|
$params = NULL , |
|
|
|
$ignore_registered_params = false |
|
) |
| |
|
static |
Augment the given URL by appending all registered link parameters. Note that for each bound variable, its current value is used. You can use the second parameter to add futher URL parameters to this link without adding them globally. Any parameters included in the argument list take precedence over registered link parameters of the same name. This method is identical to getURL() except that it returns an entity encoded URL suitable for use in HTML attributes.
- Parameters
-
string | $url | relative or absolute URL |
array | $params | array of additional link parameters to add |
bool | $ignore_registered_params | do not add registered params |
- Returns
- string modified URL (entity encoded)
◆ getLinkParams()
Get the list of currently registered link parameters.
- Returns
- array list of registered link parameters
◆ getScriptLink()
static getScriptLink |
( |
|
$url = '' , |
|
|
|
$params = NULL |
|
) |
| |
|
static |
This method is identical to getScriptURL() except that it returns an entity encoded URL suitable for use in HTML attributes.
- Parameters
-
string | $url | relative or absolute URL |
array | $params | array of additional link parameters to add |
- Returns
- string modified URL (entity encoded)
◆ getScriptURL()
static getScriptURL |
( |
|
$url = '' , |
|
|
|
$params = NULL |
|
) |
| |
|
static |
Augment the given URL by adding URL parameters from the second parameter, without bound parameters
- Parameters
-
string | $url | relative or absolute URL |
array | $params | array of additional link parameters to add |
- Returns
- string modified URL
◆ getURL()
static getURL |
( |
|
$url = '' , |
|
|
|
$params = NULL , |
|
|
|
$ignore_registered_params = false |
|
) |
| |
|
static |
Augment the given URL by appending all registered link parameters. Note that for each bound variable, its current value is used. You can use the second parameter to add futher URL parameters to this link without adding them globally. Any parameters included in the argument list take precedence over registered link parameters of the same name.
- Parameters
-
string | $url | relative or absolute URL |
array | $params | array of additional link parameters to add |
bool | $ignore_registered_params | do not add registered params |
- Returns
- string modified URL
◆ removeLinkParam()
static removeLinkParam |
( |
|
$name | ) |
|
|
static |
Remove a link parameter.
- Parameters
-
string | $name | parameter name |
◆ setBaseURL()
static setBaseURL |
( |
|
$url | ) |
|
|
static |
Set a base URL to be used when resolving relative URLs passed to URLHelper::getLink() and URLHelper::getURL(). Set this to NULL to use no base URL and skip the URL resolving step.
- Parameters
-
string | $url | relative or absolute URL (or NULL) |
- Returns
- string old URL
The documentation for this class was generated from the following file: