1 ## <a name="TWiki Variables Quickstart"></a> TWiki Variables Quickstart
3 TWiki Variables are names that are enclosed in percent signs `%` that are expanded on the fly. Some variables take arguments, such as `%INCLUDE%`. For those variables, the arguments are included in curly braces (\{ and \}).
5 <table border="1" cellpadding="0" cellspacing="0">
7 <th bgcolor="#99CCCC"><strong> Variable </strong></th>
8 <th bgcolor="#99CCCC"><strong> In brief </strong></th>
9 <th bgcolor="#99CCCC"><strong> Full documentation </strong></th>
12 <td><code>%TOC%</code></td>
13 <td> Automatically generates a table of contents based on headings in a topic - see the top of this page for an example. </td>
14 <td>[[Main/VarTOC]]</td>
17 <td><code>%WEB%</code></td>
18 <td> The current web, is <b>%WEB%</b>. </td>
19 <td>[[Main/VarWEB]]</td>
22 <td><code>%TOPIC%</code></td>
23 <td> The current topic name, is <b>WebHome</b>. </td>
24 <td>[[Main/VarTOPIC]]</td>
27 <td><code>%ATTACHURL%</code></td>
28 <td> The attachment URL of the current topic. Example usage: If you attach a file to a topic you can refer to it as <code><b>%ATTACHURL%/image.gif</b></code> to show the URL of the file or the image in your text. </td>
29 <td>[[Main/VarATTACHURL]]</td>
32 <td><code>%INCLUDE{"SomeTopic"}%</code></td>
33 <td> Server side include, includes another topic. The current web is the default web. Example: <code><b>%INCLUDE{"TWiki.SiteMap"}%</b></code></td>
34 <td>[[Main/VarINCLUDE]]</td>
37 <td><code>%SEARCH{"sushi"}%</code></td>
38 <td> Inline search showing the search result embedded in a topic. [[Main/FormattedSearch]] gives you control over formatting, useful for creating web-based applications. </td>
39 <td>[[Main/VarSEARCH]]</td>
43 [[TWikiPreferences]] defines some site-wide variables. Among them are:
45 - **Line break:** Write `%BR%` to start a new line.
46 - **Colored text:** Write: `%RED% Red %ENDCOLOR% and %BLUE% blue %ENDCOLOR% colors` to get: %RED% Red %ENDCOLOR% and %BLUE% blue %ENDCOLOR% colors.
48 There are many more variables. To see them all, go to **[[TWikiVariables]]**.
50 **Documentation Graphics:** There are many graphics available to use in your topics. Use `%ICON{"help"}%`, `%ICON{"tip"}%`, and `%ICON{"warning"}%` to get: %H%, %T%, and %X%, respectively. [[TWikiDocGraphics]] lists them all.
52 <img src="http://www.dementia.org/twiki//view/Main/WebHome/tip.gif" width="16" height="16" alt="tip" /> To "escape" a variable, prefix it with an exclamation mark. Write: `!%SOMEVARIABLE%` to get: %SOMEVARIABLE%.