System:Template:createUrl

From Aspen Documentation

Creates an absolute URL to another method/module/interface.

Since 1.0

Contents

Arguments

string createUrl ([string $method = false], [array $bits = false], [string $module = false], [string $interface = false])

method
The class method ("page") to generate a link to. If left false, it will generate a link to the current method.
bits
An array of values to append to the url. For example, array('id'=>1) will append either: /page/1 or &method=page&id=1.
module
The module the method exists within. If left false, the current module is assumed.
interface
The interface the module exists within. If left false, the current module is assumed.

Returns

Returns an absolute url as a string.

Notes

  • This function will not be available for external resources. Only applications running within the framework may utilize it.

Examples

Generating a URL to the view page of the current module:

$this->createUrl('view');


Generating a URL to the view page of the settings module:

$this->createUrl('view', false, 'Settings');


Generating a URL to edit user account #1:

$this->createUrl('edit', array('id'=>1), 'Users');