<?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><para>This page tells you more how you can use variables in wiki pages. This is especially helpful within <ulink url="http://www.nnx.me/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="3"><colspec colname="col_0"/><colspec colname="col_1"/><colspec colname="col_2"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><para> Variable         </para></entry><entry colsep="1" rowsep="1"><para> Description                                  </para></entry><entry colsep="1" rowsep="1"><para> Example </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> <ulink url="http://www.nnx.me/HelpOnVariables/HelpOnPageCreation#">HelpOnPageCreation</ulink> </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"/></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"/></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> <ulink url="http://www.nnx.me/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> <ulink url="http://www.nnx.me/HelpOnVariables/TheAnarcat#">TheAnarcat</ulink> </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> -- <ulink url="http://www.nnx.me/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> -- <ulink url="http://www.nnx.me/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> @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></row></tbody></tgroup></informaltable></section><section><title>Expanding Variables</title><para>You can use HomePageName/MyDict to expand those variables, just put a dictionary (see <ulink url="http://www.nnx.me/HelpOnVariables/HelpOnDictionaries#">HelpOnDictionaries</ulink>) there with your variables and values. For example, </para><screen><![CDATA[ VAR1:: substitution 1
 VAR2:: substitution 2]]></screen></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/!<ulink url="http://www.nnx.me/HelpOnVariables/MyDict#">MyDict</ulink> (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="15" fileref="http://www.nnx.me//moin_static197/ninuxtheme02/img/alert.png" width="15"/></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="15" fileref="http://www.nnx.me//moin_static197/ninuxtheme02/img/alert.png" width="15"/></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></article>