This page tells you more how you can use variables in wiki pages. This is especially helpful within templates, but also on "normal" wiki pages (like for signing a contribution).
Predefined Variables
The following variables are substituted when a page is saved. Note that they will appear unreplaced in the preview''''' Variable Description Example @PAGE@ Name of the page (useful for template pages) @DATE@ Current date in the system's format 2004-08-30 @TIME@ Current date and time in the user's format 2004-08-30 14:38:05 @ME@ Just the user's name @USERNAME@ Just the user's name (or his domain/IP) @USER@ Signature "-- loginname" -- TheAnarcat @SIG@ Dated Signature "-- loginname date time" -- TheAnarcat 2004-08-30 14:38:05 @EMAIL@ <<MailTo()>> Just the user's email address, obfuscation can be extended e.g. test DOT user AT example DOT com @MAILTO@ A fancy mailto: link with the user's data None - on public sites, better use the MailTo macro
If the builtin variables are not enough, you can define new variables by creating a sub-page of your home page with a dictionary of variables in it. For example, if your username is JohnDoe, you would create page JohnDoe/MyDict with the content like: Then, whenever you edit a page, you can use @VAR1@ or @VAR2 to expand to the text in that dictionary. (Note that the lines in a dictionary must start with
You can use these values using the GetVal macro: Renders as:
If the variables are set on UserName/MyDict (UserName must of course be replaced as appropriate), you can get the variables when saving any page with @var1@, @var2@, ...etc. instead of the GetVal macro.
Defining New Variables
VAR1:: some random text
VAR2:: use ''any'' wiki markup
Getting Variables
At Every Page Refresh
<<GetVal(WikiDict,var1)>> <<GetVal(WikiDict,var2)>> <<GetVal(WikiDict,var3)>>
When Saving the Page
Note that data in dict pages is cached and does not require opening and parsing the page file for each access to the value. In CGI, the value is fetched from a pickle, in long running process, the pickle is loaded once and then the value is accessed from memory.
Note that saving template pages and using preview does