Detailed Description
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.
Member Function Documentation
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 |
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 |
static getLink |
( |
|
$url = '' , |
|
|
|
$params = NULL |
|
) |
| |
|
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 |
- Returns
- string modified URL (entity encoded)
Get the list of currently registered link parameters.
- Returns
- array list of registered link parameters
static getURL |
( |
|
$url = '' , |
|
|
|
$params = NULL |
|
) |
| |
|
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 |
- Returns
- string modified URL
static removeLinkParam |
( |
|
$name | ) |
|
|
static |
Remove a link parameter.
- Parameters
-
string | $name | parameter name |
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) |
The documentation for this class was generated from the following file: