Document Properties
Kbid
24A792
Last Modified
25-Aug-2020
Added to KB
21-Jun-2013
Public Access
Everyone
Status
Online
Doc Type
References
Product
  • ICM 7.10
  • ICM 11
ISML Function - WebRoot()

Name

WebRoot()

Short Description

references static content within ISML templates

Table of Contents

Product Version

6.5

Product To Version


Status

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/appserver.properties 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">

Syntax

WebRoot()
WebRoot(<servergroup>)
WebRoot(<servergroup>, <locale>)

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.

Parameters

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.

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

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.
The Intershop Knowledge Portal uses only technically necessary cookies. We do not track visitors or have visitors tracked by 3rd parties. Please find further information on privacy in the Intershop Privacy Policy and Legal Notice.
Home
Knowledge Base
Product Releases
Log on to continue
This Knowledge Base document is reserved for registered customers.
Log on with your Intershop Entra ID to continue.
Write an email to supportadmin@intershop.de if you experience login issues,
or if you want to register as customer.