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">
WebRoot() WebRoot(<servergroup>) WebRoot(<servergroup>, <locale>)
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.
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:
-