The ContentURL()
function is used to reference static content in the static content directory of the current unit, e.g., share/sites/<site_name>/<version-id>/static/units/<unit_name>/static
.
ContentURL(<contentRef>) ContentURL(<contentRef>, [<locale>]) ContentURL(<contentRef>, [<locale>], [<servergroup>])
The following example shows how to reference an image of an offer within a unit:
<img src=#ContentURL(Product:OfferedProduct:Image)#>
When the template is processed, the content reference replaces the ISML expression Product:OfferedProduct:Image
. You can reference a product image with or without mentioning the unit it belongs to (e.g., Officeland:/images/calc.gif or /images/calc.gif
). This is shown below, along with the possibility to provide a locale ID:
<img src=#ContentURL('images/calc.gif', 'de_DE')#>
In the example, the ISML function ContentURL()
parses the string parameter given in brackets to extract unit and path names, and produces the following URL:
/is-bin/intershop.static/<group>/<current_site>/-/<locale>/images/calc.gif
The abstract result of the ContentURL()
function parsing the string parameter is the following:
<WebRoot_url>/<group>/<site>/<unit>/<locale>/<path>
Unit and path names are separated by a colon, as shown below:
<unit_name>:<path>
For example, the following reference
<a href="#ContentURL('PrimeTech:zips/p4366a.zip','de_DE')#">
is resolved to
http://
<>/is-bin/intershop.static/WFS/PrimeTech-PrimeTechSpecials-Site/…PrimeTech/de_DE/zips/p4366a.zip
The elements of this URL are explained in Table below.
Web Root Elements
URL Element | Description |
---|---|
| Specified by the property |
| Server group |
| Current site |
| Unit specified by the ContentURL parameter |
| Locale specified by the ContentURL parameter. If no locale is provided, the fallback described above is used. |
| Resource path; Intershop 7 business objects (e.g., Products) hold relative paths to the static content that is assigned to them. The syntax of such a path name is |
content reference
The content reference is a required parameter that references static content (e.g., /images/calc.gif
).
locale
This optional parameter can be used to override the default locale. If left unspecified, the following fallback is used:
-
servergroup
This optional parameter can be used to override the default server group. If left unspecified, the first value from the application server property intershop.server.assignedToServerGroup
is used.