Zeta Components Manual :: Docs For Class ezcUrlCreator
Url::ezcUrlCreator
Class ezcUrlCreator
ezcUrlCreator makes it easy to create urls from scratch.
Holds a list of urls mapped to aliases. The aliases are used to refer to the urls stored, so the urls will not be hardcoded all over the application code.
Example of use:
- // register an URL under the alias 'map'
- // retrieve the stored URL under the alias 'map' formatted with parameters
- // will be: "/images/geo/map_norway.gif?xsize=450&ysize=450&zoom=4"
- // retrieve the stored URL under the alias 'map' formatted with other parameters
- // will be: "/images/geo/map_sweden.gif?xsize=450&ysize=450&zoom=4"
Source for this file: /Url/src/url_creator.php
Version: | //autogen// |
Method Summary
public static string |
getUrl(
$name
, $args,...
)
Returns the URL registered as $name. |
public static string |
prependUrl(
$name
, $suffix
)
Returns the URL registerd as $name prepended to $suffix. |
public static void |
registerUrl(
$name
, $url
)
Registers $url as $name in the URLs list. |
Methods
getUrl
static string
getUrl(
string
$name
, mixed
$args,...
)
Returns the URL registered as $name.
This function accepts a variable number of arguments like the sprintf() function. If you specify more than 1 arguments when calling this function, the registered URL will be formatted using those arguments similar with the sprintf() function. Example:
Parameters:
Name | Type | Description |
---|---|---|
$name |
string | The name associated with the URL |
$args,... |
mixed | Optional values which will be vsprintf-ed in the URL |
Exceptions:
Type | Description |
---|---|
ezcUrlNotRegisteredException |
if $name is not registered |
prependUrl
static string
prependUrl(
string
$name
, string
$suffix
)
Returns the URL registerd as $name prepended to $suffix.
Example:
Parameters:
Name | Type | Description |
---|---|---|
$name |
string | The name associated with the URL that will be appended with $suffix |
$suffix |
string | The string which will be appended to the URL |
Exceptions:
Type | Description |
---|---|
ezcUrlNotRegisteredException |
if $name is not registered |
registerUrl
static void
registerUrl(
string
$name
, string
$url
)
Registers $url as $name in the URLs list.
If $name is already registered, it will be overwritten.
Parameters:
Name | Type | Description |
---|---|---|
$name |
string | The name associated with the URL |
$url |
string | The URL to register |
Documentation generated by phpDocumentor 1.4.3