Template Macro

The "Template" macro allows you to include the script passed as argument into the current script. Only the Velocity parser will be executed on the file passed as argument.

Usage

#template($relativeURL)

Only the Velocity parser will be executed on the file passed as argument. The priority of the executed files is as follows:

  • a property of the XWiki.XWikiSkins object attached to the current skin document.
  • a ".vm" file attached to the current skin document.
  • a ".vm" file located in the directory corresponding to the current skin as shown in the below examples.
  • the above 3 locations corresponding to the base skin.
  • the above 3 locations corresponding to the default skin.
  • a ".vm" file located in the "templates" folder as shown in the below examples.

Parameters

The $relativeURL is the path to the included script which can be:

  •  a relative URL to a folder on your filesystem like for instance a skin directory:
    #template('C:\Apache Software Foundation\Tomcat 6.0\webapps\xwiki\skins\colibri\customTemplate.vm')

    #template('C:\Apache Software Foundation\Tomcat 6.0\webapps\xwiki\skins\colibri\templates\customTemplate.vm')
  • the name of a default XWiki Velocity template file (i.e. located in the "templates" folder):
    #template('warning.vm')

Related Pages

Trying to decide between Cloud and On Premise? See the comparison on the XWiki Help Center.

Search this space