ISML Function - ContentURL()

Name

ContentURL()

Short Description

reference static content in the static content directory of the current unit

Table of Contents

Product Version

6.5

Product To Version

 

Statusfinal

1 Introduction

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.

2 Syntax

ContentURL(<contentRef>)
ContentURL(<contentRef>, [<locale>])
ContentURL(<contentRef>, [<locale>], [<servergroup>])

3 Example

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

<WebRoot_url>

Specified by the property intershop.template.(Https)WebRootURL, the default value of which is /is-bin/intershop.static(see the appserver.properties file).

<group>

Server group

<site>

Current site

<unit>

Unit specified by the ContentURL parameter

<locale>

Locale specified by the ContentURL parameter. If no locale is provided, the fallback described above is used.

<path>

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 <unit_name>:<path>.

4 Parameters

4.1 content reference

The content reference is a required parameter that references static content (e.g., /images/calc.gif).

4.2 locale

This optional parameter can be used to override the default locale. If left unspecified, the following fallback is used:

  1. the request's current locale
  2. the lead locale
  3. the locale will be designated as a missing parameter -

4.3 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.

Reference - ISML Functions

Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Support Tickets