ez.no / exponential / documentation / reference / template operators / urls / ezdesign
$input_string|ezdesign( [ quote ] )
| Name | Type | Description | Required |
|---|---|---|---|
| quote | string | Type of quote: single, double, no. Default is double. | no |
input string prepended with correct path.
This operator prepends the current site-design directory to the inputted text. The result is a valid file location. The operator will first check if the file specified in the input string exists in the current design directory. If it is found, the path of the current design directory will be prepended. If the operator is unable to find the file within the current design directory, it will attempt to find the file within one of the additional designs. If the file is still not found, the string will be prepended with the path to the standard design directory.
By default, the returned string is encapsulated by double quotes. However, this can be changed by using the quote parameter. The quote parameter can be set to either "single", "double" or "no". The "single" option tells the operator to encapsulate the returned string in single quotes and "no" will simply tell the operator to drop quotes completely. Dropping quotes is useful when specifying CSS files in the following way:
<style type="text/css"> @import url({'stylesheets/core.css'|ezdesign( no )}); @import url({'stylesheets/ezmain.css'|ezdesign( no )}); @import url({'stylesheets/7x.css'|ezdesign( no )}); </style>
In order to make sure that an Exponential site works correctly in all possible situations (virtual host, non virtual host, installation has been moved, etc.) this operator must be used every time a design-related file is specified within template code. For example, it should be used when specifying which CSS files to use.
Let's say that the current design directory (specified within the siteaccess that is being accessed) is "my_company". Since this is a design directory, it must reside within the design directory inside an Exponential installation. In other words, the path to this directory would be "/design/my_company". Now, let's say that you wish to make use of a CSS file called "test.css". This CSS file should of course be placed within the "/design/my_company/stylesheets" directory. In the main template for your design (pagelayout.tpl), you would have to include the "test.css" file like this:
<link rel="style... href={"stylesheets/test.css"|ezdesign} />
When Exponential processes the template code, it will automatically prepend the correct design directory to string that was piped into the ezurl operator. In this case, the string will be translated into the following:
<link rel="style... href="/design/my_company/stylesheets/test.css" />
If the "/design/my_company/stylesheets/test.css" does not exist, then Exponential will simply prepend the path to the standard design directory. In this case, the output will be:
<link rel="style... href="/design/standard/stylesheets/test.css" />
..regardless of the existence of "test.css" within the standard design directory. This happens when "test.css" doesn't exist in either the current design or any of the possible additional designs. (Note that the HTML code above has been simplified in order to keep it short.)
Comments