ezurl
Summary
Returns a working version of an eZ Publish URL (provided as input).Usage
input|ezurl( [ quote [, type ] ] )
Parameters
Name | Type | Description | Required |
---|---|---|---|
quote | string | Quote style: "no", "single" or "double" (default). | No. |
type | string | URL type: "full" or "relative" (default). | No. |
Returns
A quoted string containing a valid / working version of the input URL.Description
This operator takes an eZ Publish URL as input (either a system URL or a virtual URL); based on the location of the eZ Publish folder, the access settings and the environment, it will produce a valid address. All eZ Publish URLs that are specified in templates should always be piped through this operator; it will make sure that the URLs work regardless where eZ Publish is installed, which access method is used, and so on.
By default, this operator returns a relative URL as a double-quoted string. The optional "quote" parameter can be used to control the way the address is returned: "no" (no quotes), "single" (single quotes) or "double" (double quotes, the default). The optional "type" parameter controls whether relative or full URL is returned.
Examples
Example 1
Let's say that we're running a site called "my_company" (name of the siteaccess) and that we wish to create a link to the full view of node number 1024. Instead of specifying the entire URL (domain and all included) in the link tag, we pipe "/content/view/full/1024" or the virtual URL (for example "/test") through the "ezurl" operator:
<a href={'/content/view/full/1024'|ezurl(,'full')}>Test</a> <a href={'/test'|ezurl(,'full')}>Test</a>
The operator will take care of translating the URLs into valid addresses depending on the setup and the environment eZ Publish is running in. If eZ Publish is running in a virtual host environment and uses the host access method, the following type of URLs will be produced:
"http://www.example.com/content/view/full/1024"
"http://www.example.com/test"
The "index.php" part of the URL will be supressed by the virtual host configuration. The name of the siteaccess will not appear in the URL because eZ Publish will use the domain/host to figure out which siteaccess to use.
If eZ Publish is running in a non-virtual host environment and uses the uri access method, the following URLs will be produced:
"http://www.example.com/index.php/my_company/content/view/full/1024"
"http://www.example.com/index.php/my_company/test"
Example 2
<a href={'/content/view/full/1024'|ezurl()}>Test</a> <a href={'/test'|ezurl()}>Test</a>
If eZ Publish is running in a virtual host environment and uses the host access method, the following type of URLs will be produced:
"/content/view/full/1024"
"/test"
The "index.php" part of the URL will be supressed by the virtual host configuration. The name of the siteaccess will not appear in the URL because eZ Publish will use the domain/host to figure out which siteaccess to use.
If eZ Publish is running in a non-virtual host environment and uses the uri access method, the following URLs will be produced:
"/index.php/my_company/content/view/full/1024"
"/index.php/my_company/test"
Balazs Halasy (05/02/2004 11:49 am)
Svitlana Shatokhina (11/08/2006 11:00 am)
Comments
Layout
Tuesday 14 November 2006 7:17:07 pm
Alimi Nabil
You sometimes need to get back to the default layout.