URL Plugin
The url plugin gives you access to URL data and logic.
url:current
Displays the full current URL.
Example
{{ url:current }}
Returns:
'http://www.example.com/current/uri/'
url:uri_string
Displays the current URI string.
Example
{{ url:uri_string }}
Returns:
'current/uri'
url:site
Displays the full site URL. Use this to generate links within your site - supply URL segments and generate a full (absolute) URL with domain name and path.
Attributes
| Name | Default | Required | Description |
|---|---|---|---|
| uri | None | No | URI segments passed to the site_url function. |
Example
With no URI specified:
{{ url:site }}
Returns:
'http://www.example.com'
With a URI specified:
{{ url:site uri="contact" }}
Returns:
'http://www.example.com/contact'
url:base
Displays the full site base URL regardless of mod_rewrite settings.
Example
{{ url:base }}
Returns:
'http://www.example.com/'
url:segments
Displays a specific URL segment.
Attributes
| Name | Default | Required | Description |
|---|---|---|---|
| segment | None | Yes | Number of segment (left to right, first segment is 1). |
| default | None | No | Default value if selected segment does not exist/is not in use. |
Example
{{ url:segments segment="1" default="home" }}
If the url is http://www.example.com/products, the tag above will return:
products
url:anchor
Generates an anchor tag (a link) with an absolute URL (domain name and path) from URI segments. Essentially a wrapper for built in anchor() function found in the url helper.
Attributes
| Name | Default | Required | Description |
|---|---|---|---|
| segments | None | Yes | Segments passed to the anchor function. |
| title | None | No | Text displayed between <a></a> tags. If omitted, URL is duplicated. |
| class | None | No | Optional CSS class. |
Example
{{ url:anchor segments="users/login" title="Login" class="login" }}
Returns:
<a href="http://www.example.com/users/login" class="login">Login</a>
url:redirect
Since 2.2.1. Allows you to perform a 302 redirect to another page or URL.
Attributes
| Name | Default | Required | Description |
|---|---|---|---|
| to | None | Yes | The URI to redirect to. |
Example
{{ url:redirect to="new/page" }}
