\Hazaar\Application
Url
Generate a URL relative to the application

This is the base method for generating URLs in your application. URLs generated directly from here are relative to the application base path. For URLs that are relative to the current controller see Controller::url()

Parameters are dynamic and depend on what you are trying to generate.

For examples see Generating URLs in the Hazaar MVC support documentation.

Tags

Since

1.0.0

Summary
Methods Properties Constants
No constants
Properties
$controller
$controller
$hash
$hash
$method
$method
$params
$params
$path
$path
Methods
__construct()
__construct()
__tostring()
__tostring()

Magic method to output a string URL.

renderObject()
renderObject($inc_path = true, $params = null) : string
Write the URL as a string

Parameters

$inc_pathboolean

Include the URL path part. Defaults to true. Allows just the host part to be returned.

$paramsarray

Override the default params with parameters in this array.

Returns

string

The resulting URL based on the constructor arguments.

setParams()
setParams($params, $merge = false)
Set the HTTP request parameters on the URL

Parameters

$params

No description

$merge

No description

toString()
toString($values = null) : string
Write the URL as a string

This method optionally takes an array to use to filter any placeholder parameters. Parameters support special placholder values that are prefixed with a ‘$’, such as $name. The actual value is then taken from the array supplied to this method and replaced in the output. This allows a single URL object to be used multiple times and it’s parameters changed

Example:

$url = new \Hazaar\Application\Url('controller', 'action', array('id' => '$id')); echo $url->toString(array('id' => 1234));

This will output something like: http://localhost/controller/action?id=1234

Parameters

$valuesboolean

No description

Returns

string

The resulting URL based on the constructor arguments.