DWiki Global Variables

As TemplateSyntax discusses, one can use global variables in templates in several ways. However, it helps to know what global variables are available. Thus this incomplete listing.

First, all ConfigurationFile directives are available as global variables.

Then, during request processing DWiki internally defines a number of additional global variables:

page The current page's full path, in DWiki form.
abspage The current page's full path, including a '/' at the start.
pagename The page's name; its last path component.
pagetype The type of the page, usually 'file' or 'dir'.
view-format The current view being processed.
relname In blog::blog, the name of the current page relative to the blog directory being displayed.
basepage In a VirtualDirectory context, the full path of the non-virtual directory. Otherwise the same as page.
:wikitext:title After a piece of wikitext has been rendered (more exactly after any wikitext template renderer has been used, including wikitext:cache), this is its title if any exists. The 'title' of a piece of wikitext is the text of the header that is at the start of the text, if there is one. This is the same as the wikitext:title template renderer but may be more convenient to use.
:wikitext:title:nohtml This is the title but without any HTML markup, making it useful for eg a <title>. It's the same as the :wikitext:title:nohtml template renderer.
login The currently authenticated user.
comment-ip IP address that posted the current comment.
comment-login Login of the user that posted the current comment, if it is not the anonymous user.
comment-name The supplied name of the user that posted the current comment, if any.
comment-url The user's supplied website URL (if any) for the current comment.
:comment:post The result of an attempt to post a comment. One of 'good', 'bad', 'badchar', or 'nocomment' (the latter if it was an attempt to post an empty comment). (Only defined during comment posting.)
:error:error Error type. Only defined during error processing.
:error:code The numerical HTTP status code for an error. Only defined during error processing.
http-command The type of HTTP command being processed, either GET or POST.
http-version The (claimed) version of HTTP that the current request used.
remote-ip The IP address the current request came from.
server-name The hostname or IP address for this web server that the sender of the current request claims to have used.

Not all of these are defined all of the time. Generally a context-dependant variable is only defined when the current thing being processed has that sort of information.

There are other global variables that get set, but they are for more internal use, and you're best off browsing the source code for them.

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Thu Aug 29 16:47:40 2013
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.