ezurl

Summary

Makes sure that a URL works in both VH and NVH environments.

Usage

$input_string|ezurl(  )

Returns

string containing correct/valid URL.

Description

This operator prepends a string to a URL which by itself would have been invalid. The string that is prepended depends on the siteaccess that is accessed and the environment Exponential is running in. This can be either Virtual Host (VH) or Non Virtual Host (NVH) mode. Please refer to the documentation of the webserver for details about these modes/techniques.

All URLs that are specified in Exponential templates should be piped through the ezurl operator. This will make sure that all URLs work in different setups and in different environments.

Examples

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 simply pipe "/content/view/full/1024" or it's URL alias (in this case "/test") through the ezurl operator:

<a href={"/content/view/full/1024"|ezurl}>Test</a>

<a href={"/test"|ezurl}>Test</a>

The operator will take care of translating the strings into a valid URLs depending on the setup and the environment Exponential is running in:

Virtual host environment:
http://www.example.com/content/view/full/1024
http://www.example.com/test

No virtual host, plain/basic environment:
http://www.example.com/index.php/my_company/content/view/full/1024
http://www.example.com/index.php/my_company/test

Comments

Contents

Reference

Database diagram
Template operators
    PDF
    Arrays
    Data extraction
    Formatting
    Images
    Logic
    Mathematics
    Miscellaneous
    Strings
    URLs
       ezdesign
       ezimage
       ezroot
       ezurl
       exturl
    Variables
Template functions
Data fetching
Modules
XML tags


Created

05/02/2004
12:49:19 pm
by Balazs Halasy

Last updated

09/02/2004
3:27:00 pm
by Balazs Halasy

Authors

Balazs Halasy



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.