ISML Function - WebRoot()



Short Description

references static content within ISML templates

Table of Contents

Product Version


Product To Version


1 Introduction

This function is used to reference static content, e.g., images or other external files, within ISML templates.
WebRoot() points to the static content directory of the current site (e.g. share/sites/site_name/version-id/static) or the cartridge-based content directories, where reference material is stored.

WebRoot() returns the intershop.template.WebRootURL property of the storefront and the current locale as a string. You can configure what WebRoot() returns globally, in the config/cluster/ file.
By default, WebRoot() returns /INTERSHOP/static.

For example, the following ISML code:

<img src="#WebRoot()#/en_US/images/comp.gif">

Results in the following HTML code:

<img src="/INTERSHOP/static/<group>/<site>/en_US/images/comp.gif">

2 Syntax

WebRoot(<servergroup>, <locale>)

3 Example

To reference an external text file, e.g., a CSS definitions file:

<link rel="stylesheet" href="#WebRoot()#/general.css" type="text/css">

To reference an image of an offer within a site:

<img src="#WebRoot()#Product:OfferedProduct:Image>

To reference the george.gif image in the MyStorefront.isml template. Locate the file george.gif in your file system, then add the following code to your template:

<img src="#WebRoot()#/imagesOnline/george_gif”>

Save the changes and test the result in the storefront.

4 Parameters

4.1 servergroup

servergroup = string
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.

4.2 locale

locale = string
This optional parameter can be used to override the default locale. If left unspecified, the following fallback values will be used instead:

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

Reference - ISML Functions


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