Variable evaluation order#
The variables are evaluated in the following order:- 'Preset' variables (or constants), as those listed on this page.
- 'Context' variables, as those set by plugins and tags.
- 'Property' variables, like those set in jspwiki.properties.
- 'Page' variables, like those set using the "SET" directive.
Overview#
WikiVariables are variables that are evaluated when a page is viewed.The two types of WikiVariables are defined below.
Page Variables#
Starting with JSPWiki 2.2, you can use the "SET" directive to define a variable that exists only in the page.You can access this value anywhere on your page by using the shorthand "[{$foo}]".
_
Accessing Page WikiVariables "[{$test}]" before it is set:
test = No such variable: No variable test defined.
Then setting 'foo' to 'bar' For example:
[{SET foo='bar'}]creates you a variable called "foo", which has the value of "bar".
Accessing "[{$foo}]" After it is set:
foo = bar
Pre-defined Variables#
Variable | Description | Value | Code |
---|---|---|---|
applicationname | This is the name of this Wiki. It has been set by the administrator in "jspwiki.properties". | Ldapwiki | [{$applicationname}] |
baseurl | The base URL address for this wiki | http://ldapwiki.com/ | [{$baseurl}] |
encoding | Describes the character encoding used in this Wiki. An encoding of "UTF-8" means that the Wiki accepts any character, including Chinese, Japanese, etc. Encoding "ISO-8859-1" means that only western languages are supported. | UTF-8' | [{$encoding}] |
inlinedimages | Lets you know which image types are able to be inlined | https://ldapwiki.com/images/*, *.png, *.jpg | [{$inlinedimages}] |
interwikilinks | Writes HTML code for supported InterWiki links | WikiWikiWeb --> http://c2.com/cgi/wiki?%s, JSPWiki --> http://jspwiki-wiki.apache.org/Wiki.jsp?page=%s, Doc --> http://jspwiki-wiki.apache.org/Wiki.jsp?page=%s, TWiki --> http://twiki.org/cgi-bin/view/TWiki/%s, Wikipedia --> http://www.wikipedia.com/wiki/%s, Google --> http://www.google.com/search?q=%s, RFC --> https://tools.ietf.org/html/rfc%s, MeatballWiki --> http://usemod.com/cgi-bin/mb.pl?%s, Edit --> Edit.jsp?page=%s | [{$interwikilinks}] |
jspwikiversion | Inserts the version number of the JSPWiki engine. | 2.10.1 | [{$jspwikiversion}] |
loginstatus | Shows the status of the current logged-in user | anonymous | [{$loginstatus}] |
uptime | Inserts the amount of time since this Wiki has been last restarted | 8d, 0h 35m 19s | [{$uptime}] |
pagename | Inserts the current page name. | WikiVariables | [{$pagename}] |
pageprovider | The current PageProvider | org.apache.wiki.providers.VersioningFileProvider | [{$pageprovider}] |
pageproviderdescription | A verbose, HTML description about the currently used page provider | [{$pageproviderdescription}] | |
requestcontext | The current RequestContext | view | [{$requestcontext}] |
totalpages | The total number of pages available in this Wiki | 16372 | [{$totalpages}] |
username | Inserts the current user name | 54.85.57.0 | [{$username}] |
inlinedimages | Inlined images on Ldapwiki | https://ldapwiki.com/images/*, *.png, *.jpg | [{$inlinedimages}] |
pagefilters | Installed PageFilters | [{$pagefilters}] |
Inserting JSPWiki properties#
You can also access some of the JSPWiki properties (that have been defined by the site maintainer) by using their property names directly. See SystemInfo for an example. Note that some properties might not be accessible due to security reasons.
You can also obtain some data from the JSPWiki Plugins.
Needs more info on how to set global variables in jspwiki.properties. I cannot find how anywhere..