<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>HelpOnVariables</title></articleinfo><section><title>Variables</title><para><!--The macro TableOfContents doesn't work with the DocBook formatter.--> This page tells you more how you can use variables in wiki pages. This is especially helpful within <ulink url="http://id3.org/HelpOnVariables/HelpOnTemplates#">templates</ulink>, but also on &quot;normal&quot; wiki pages (like for signing a contribution). </para><section><title>Predefined Variables</title><para>The following variables are substituted when a page is saved. <emphasis><emphasis role="strong">Note that they will appear unreplaced in the preview!</emphasis></emphasis> </para><informaltable><tgroup cols="4"><colspec colname="col_0"/><colspec colname="col_1"/><colspec colname="col_2"/><colspec colname="col_3"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><para> <emphasis role="strong">Variable</emphasis> </para></entry><entry colsep="1" rowsep="1"><para> <emphasis role="strong">Description</emphasis>                            </para></entry><entry colsep="1" rowsep="1"><para> <emphasis role="strong">Example – markup</emphasis>                             </para></entry><entry colsep="1" rowsep="1"><para> <emphasis role="strong">Example – render</emphasis> </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> @PAGE@                             </para></entry><entry colsep="1" rowsep="1"><para> Name of the page (useful for template pages) </para></entry><entry colsep="1" rowsep="1"><para> <code>HelpOnPageCreation</code>                               </para></entry><entry colsep="1" rowsep="1"><para> <ulink url="http://id3.org/HelpOnVariables/HelpOnPageCreation#">HelpOnPageCreation</ulink>     </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> @TIMESTAMP@                        </para></entry><entry colsep="1" rowsep="1"><para> Raw time stamp                               </para></entry><entry colsep="1" rowsep="1"><para> <code>2004-08-30T06:38:05Z</code>                             </para></entry><entry colsep="1" rowsep="1"><para> 2004-08-30T06:38:05Z   </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> @DATE@                             </para></entry><entry colsep="1" rowsep="1"><para> Current date in the system's format          </para></entry><entry colsep="1" rowsep="1"><para> <code>&lt;&lt;Date(2004-08-30T06:38:05Z)&gt;&gt;</code>                   </para></entry><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> @TIME@                             </para></entry><entry colsep="1" rowsep="1"><para> Current date and time in the user's format   </para></entry><entry colsep="1" rowsep="1"><para> <code>&lt;&lt;DateTime(2004-08-30T06:38:05Z)&gt;&gt;</code>               </para></entry><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> @ME@                               </para></entry><entry colsep="1" rowsep="1"><para> Just the user's name                         </para></entry><entry colsep="1" rowsep="1"><para> <code>TheAnarcat</code>                                       </para></entry><entry colsep="1" rowsep="1"><para> <ulink url="http://id3.org/HelpOnVariables/TheAnarcat#">TheAnarcat</ulink> </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> @USERNAME@                         </para></entry><entry colsep="1" rowsep="1"><para> Just the user's name (or his domain/IP)      </para></entry><entry colsep="1" rowsep="1"><para> <code>TheAnarcat</code>                                       </para></entry><entry colsep="1" rowsep="1"><para> <code>TheAnarcat</code> </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> @USER@                             </para></entry><entry colsep="1" rowsep="1"><para> Signature &quot;-- loginname&quot;                     </para></entry><entry colsep="1" rowsep="1"><para> <code>-- TheAnarcat</code>                                    </para></entry><entry colsep="1" rowsep="1"><para> -- <ulink url="http://id3.org/HelpOnVariables/TheAnarcat#">TheAnarcat</ulink> </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> @SIG@                              </para></entry><entry colsep="1" rowsep="1"><para> Dated Signature &quot;-- loginname date time&quot;     </para></entry><entry colsep="1" rowsep="1"><para> <code>-- TheAnarcat &lt;&lt;DateTime(2004-08-30T06:38:05Z)&gt;&gt;</code> </para></entry><entry colsep="1" rowsep="1"><para> -- <ulink url="http://id3.org/HelpOnVariables/TheAnarcat#">TheAnarcat</ulink> <!--The macro DateTime caused an error and should be blacklisted. It returned the data '2004-08-30 06:38:05' which caused the docbook-formatter to choke. Please file a bug.--> </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> @EMAIL@                            </para></entry><entry colsep="1" rowsep="1"><para> <code>&lt;&lt;MailTo()&gt;&gt;</code> Just the user's email address, obfuscation can be extended </para></entry><entry colsep="1" rowsep="1"><para> e.g. test DOT user AT example DOT com </para></entry><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para> @MAILTO@                           </para></entry><entry colsep="1" rowsep="1"><para> A fancy mailto: link with the user's data    </para></entry><entry colsep="1" rowsep="1"><para> None – on public sites, better use the MailTo macro </para></entry><entry colsep="1" rowsep="1"/></row></tbody></tgroup></informaltable></section><section><title>Defining New Variables</title><para>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 <code>JohnDoe/MyDict</code> with the content like: </para><screen><![CDATA[ VAR1:: some random text
 VAR2:: use ''any'' wiki markup]]></screen><para>Then, whenever you edit a page, you can use <code>@VAR1@</code> or <code>@VAR2</code> to expand to the text in that dictionary.  (Note that the lines in a dictionary must start with <emphasis>exactly</emphasis> one space.) </para></section><section><title>Getting Variables</title><section><title>At Every Page Refresh</title><para>You can use these values using the <code>GetVal</code> macro: </para><screen><![CDATA[<<GetVal(WikiDict,var1)>> <<GetVal(WikiDict,var2)>> <<GetVal(WikiDict,var3)>>]]></screen><para>Renders as: </para></section><section><title>When Saving the Page</title><para>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 <code>GetVal</code> macro.  </para><!--rule (<hr>) is not applicable to DocBook--><para><inlinemediaobject><imageobject><imagedata depth="16" fileref="http://id3.org/moin_static199/moniker/img/alert.png" width="16"/></imageobject><textobject><phrase>/!\</phrase></textobject></inlinemediaobject> 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. </para><para><inlinemediaobject><imageobject><imagedata depth="16" fileref="http://id3.org/moin_static199/moniker/img/alert.png" width="16"/></imageobject><textobject><phrase>/!\</phrase></textobject></inlinemediaobject> Note that saving template pages and using preview does <emphasis>not</emphasis> expand variables. Other than that, variable expansion is very global and happens anywhere on the page, including code displays, comments, processing instructions and other &quot;special&quot; areas of a page you might think are excluded. </para></section></section></section></article>