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:
Source for this file: /Url/src/url_creator.php
Version: | //autogen// |
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. |
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:
Name | Type | Description |
---|---|---|
$name |
string | The name associated with the URL |
$args,... |
mixed | Optional values which will be vsprintf-ed in the URL |
Type | Description |
---|---|
ezcUrlNotRegisteredException |
if $name is not registered |
Returns the URL registerd as $name prepended to $suffix.
Example:
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 |
Type | Description |
---|---|
ezcUrlNotRegisteredException |
if $name is not registered |
Registers $url as $name in the URLs list.
If $name is already registered, it will be overwritten.
Name | Type | Description |
---|---|---|
$name |
string | The name associated with the URL |
$url |
string | The URL to register |