none
[openafs-wiki.git] / TWiki / TWikiVariables.mdwn
1 <div>
2   <ul>
3     <li><a href="#TWiki Variables"> TWiki Variables</a><ul>
4         <li><a href="#Predefined Variables"> Predefined Variables</a></li>
5         <li><a href="#Preferences Variables"> Preferences Variables</a></li>
6         <li><a href="#Setting Preferences"> Setting Preferences</a></li>
7         <li><a href="#Creating Custom Variables"> Creating Custom Variables</a></li>
8       </ul>
9     </li>
10   </ul>
11 </div>
12
13 # <a name="TWiki Variables"></a> TWiki Variables
14
15 _Special text strings expand on the fly to display user data or system info_
16
17 TWikiVariables are text strings - `%VARIABLE%` - that expand into content whenever a page is rendered for viewing. `VARIABLES` are replaced by data, either user-entered or automatically generated by TWiki (like the date, or the current username). There are predefined variables, and Preference variables that you can configure. You can also define custom variables, with new names and values.
18
19 **_Notes:_**
20
21 - To leave a variable unexpanded, precede it with an exclamation point, e.g. type `!%TOPIC%` to get %TOPIC%.
22 - Variables are expanded relative to the topic they are _used_ in, not the topic they are _defined_ in.
23
24 ## <a name="Predefined Variables"></a> Predefined Variables
25
26 Most predefined variables return values that were either set in the <code>**lib/twiki.cfg**</code> file, when TWiki was installed, or taken from server info (like current username, or date and time). Many of the variables let you format the appearance of the display results.
27
28 - %T% **Take the time to thoroughly read through ALL preference variables.** If you actively configure your site, review variables periodically. They cover a wide range of functions, and it can be easy to miss the one perfect variable for something you have in mind. For example, see <code>**%INCLUDINGTOPIC%**</code>, <code>**%INCLUDE%**</code>, and the mighty <code>**%SEARCH%**</code>.
29
30 This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the following variables (enclosed in <code>**%**</code> percent signs):
31
32 **_Note:_** Above text is included from [[TWikiVariablesAtoM]] and [[TWikiVariablesNtoZ]]
33
34 <a name="PreferencesVariables"></a>
35
36 ## <a name="Preferences Variables"></a> Preferences Variables
37
38 Additional variables are defined in the preferences topics:
39
40 - site-level ( **_SL_** ) in [[TWikiPreferences]]
41 - web-level ( **_WL_** ) in [[WebPreferences]] of each web
42 - user level ( **_UL_** ) in individual user topics
43
44 <table align="center" border="1" cellpadding="2" cellspacing="0" style="background-color: #f5f5f5">
45   <tr>
46     <th width="160"> Variable: </th>
47     <th> Level: </th>
48     <th> What: </th>
49     <th>Expands to:</th>
50   </tr>
51   <tr>
52     <td><code>%ALLOWTOPICCHANGE%</code></td>
53     <td><strong><em>(any topic)</em></strong></td>
54     <td> List of users and groups who are <strong>allowed</strong> to change the current topic. (More in [[Main/TWikiAccessControl]]) </td>
55     <td> %ALLOWTOPICCHANGE%  </td>
56   </tr>
57   <tr>
58     <td><code>%ALLOWTOPICRENAME%</code></td>
59     <td><strong><em>(any topic)</em></strong></td>
60     <td> List of users and groups who are <strong>allowed</strong> to rename the current topic. (More in [[Main/TWikiAccessControl]]) </td>
61     <td> %ALLOWTOPICRENAME%  </td>
62   </tr>
63   <tr>
64     <td><code>%ALLOWWEBCHANGE%</code></td>
65     <td><strong><em>WL</em></strong></td>
66     <td> List of users and groups who are <strong>allowed</strong> to change topics in the %WIKITOOLNAME% web. (More in [[Main/TWikiAccessControl]]) </td>
67     <td> %ALLOWWEBCHANGE%  </td>
68   </tr>
69   <tr>
70     <td><code>%ALLOWWEBRENAME%</code></td>
71     <td><strong><em>WL</em></strong></td>
72     <td> List of users and groups who are <strong>allowed</strong> to rename topics in the %WIKITOOLNAME% web. (More in [[Main/TWikiAccessControl]]) </td>
73     <td> %ALLOWWEBRENAME%  </td>
74   </tr>
75   <tr>
76     <td><code>%ATTACHLINKBOX%</code></td>
77     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
78     <td> Default state of the link check box in the attach file page. Check box is initially checked if value is set to <code>CHECKED</code> , unchecked if empty. If checked, a link is created to the attached file at the end of the topic. Value is: <b><code>%ATTACHLINKBOX%</code></b></td>
79     <td> %ATTACHLINKBOX%  </td>
80   </tr>
81   <tr>
82     <td><code>%DENYTOPICCHANGE%</code></td>
83     <td><strong><em>(any topic)</em></strong></td>
84     <td> List of users and groups who are <strong>not allowed</strong> to change the current topic. (More in [[Main/TWikiAccessControl]]) </td>
85     <td> %DENYTOPICCHANGE%  </td>
86   </tr>
87   <tr>
88     <td><code>%DENYTOPICRENAME%</code></td>
89     <td><strong><em>(any topic)</em></strong></td>
90     <td> List of users and groups who are <strong>not allowed</strong> to rename the current topic. (More in [[Main/TWikiAccessControl]]) </td>
91     <td> %DENYTOPICRENAME%  </td>
92   </tr>
93   <tr>
94     <td><code>%DENYWEBCHANGE%</code></td>
95     <td><strong><em>WL</em></strong></td>
96     <td> List of users and groups who are <strong>not allowed</strong> to change topics in the %WIKITOOLNAME% web. (More in [[Main/TWikiAccessControl]]) </td>
97     <td> %DENYWEBCHANGE%  </td>
98   </tr>
99   <tr>
100     <td><code>%DENYWEBRENAME%</code></td>
101     <td><strong><em>WL</em></strong></td>
102     <td> List of users and groups who are <strong>not allowed</strong> to rename topics in the %WIKITOOLNAME% web. (More in [[Main/TWikiAccessControl]]) </td>
103     <td> %DENYWEBRENAME%  </td>
104   </tr>
105   <tr>
106     <td><code>%DONTNOTIFYCHECKBOX%</code></td>
107     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
108     <td> Default state of the "Minor Changes, Don't Notify" ([[Main/DontNotify]]) check box in preview. Check box is initially checked if <code>Set DONTNOTIFYCHECKBOX = checked="checked"</code>, or unchecked if empty. Value is: <b><code>%DONTNOTIFYCHECKBOX%</code></b></td>
109     <td> %DONTNOTIFYCHECKBOX%  </td>
110   </tr>
111   <tr>
112     <td><code>%EDITBOXHEIGHT%</code></td>
113     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
114     <td> Vertical size of edit box, is <b> <code>%EDITBOXHEIGHT%</code> </b></td>
115     <td> %EDITBOXHEIGHT%  </td>
116   </tr>
117   <tr>
118     <td><code>%EDITBOXWIDTH%</code></td>
119     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
120     <td> Horizontal size of edit box, is <b> <code>%EDITBOXWIDTH%</code> </b></td>
121     <td> %EDITBOXWIDTH%  </td>
122   </tr>
123   <tr>
124     <td><code>%EDITBOXSTYLE%</code></td>
125     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
126     <td> Style of text edit box. Set to <code>width: 99%</code> for full window width (default; overwrites the EDITBOXWIDTH setting), or <code>width: auto</code> to disable. Value is: <b><code>%EDITBOXSTYLE%</code></b></td>
127     <td> %EDITBOXSTYLE%  </td>
128   </tr>
129   <tr>
130     <td><code>%FINALPREFERENCES%</code></td>
131     <td><strong><em>SL</em></strong> , <strong><em>WL</em></strong></td>
132     <td> List of preferences that are not allowed to be overridden by next level preferences</td>
133     <td> %FINALPREFERENCES%  </td>
134   </tr>
135   <tr>
136     <td><code>%HTTP_EQUIV_ON_EDIT%</code></td>
137     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
138     <td> http-equiv meta tags for edit script. </td>
139     <td> %HTTP_EQUIV_ON_EDIT%  </td>
140   </tr>
141   <tr>
142     <td><code>%HTTP_EQUIV_ON_PREVIEW%</code></td>
143     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
144     <td> http-equiv meta tags for preview script. </td>
145     <td> %HTTP_EQUIV_ON_PREVIEW%  </td>
146   </tr>
147   <tr>
148     <td><code>%HTTP_EQUIV_ON_VIEW%</code></td>
149     <td><strong><em>SL</em></strong></td>
150     <td> http-equiv meta tags for view, rdiff, attach, search* scripts. </td>
151     <td> %HTTP_EQUIV_ON_VIEW%  </td>
152   </tr>
153   <tr>
154     <td><code>%NEWTOPICBGCOLOR%</code></td>
155     <td><strong><em>SL</em></strong> , <em>UL</em></td>
156     <td> Background color of non existing topic. ( <strong><em>UL</em></strong> needs authentication for topic views ) </td>
157     <td> %NEWTOPICBGCOLOR%  </td>
158   </tr>
159   <tr>
160     <td><code>%NEWTOPICFONTCOLOR%</code></td>
161     <td><strong><em>SL</em></strong> , <em>UL</em></td>
162     <td> Font color of non existing topic. ( <strong><em>UL</em></strong> needs authentication for topic views ) </td>
163     <td> %NEWTOPICFONTCOLOR%  </td>
164   </tr>
165   <tr>
166     <td><code>%NOSEARCHALL%</code></td>
167     <td><strong><em>WL</em></strong></td>
168     <td> Exclude web from a <code>web="all"</code> search (set variable to <code>on</code> for hidden webs) </td>
169     <td> %NOSEARCHALL%  </td>
170   </tr>
171   <tr>
172     <td><code>%RELEASEEDITLOCKCHECKBOX%</code></td>
173     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
174     <td> Default state of the "Release edit lock" ([[Main/UnlockTopic]]) check box in preview. Checkbox is initially checked if <code>Set RELEASEEDITLOCKCHECKBOX = checked="checked"</code>, or unchecked if empty. If checked, make sure to click on <u>Edit</u> to do more changes; do <strong>not</strong> go back in your browser to the edit page, or you risk that someone else will edit the topic at the same time! Value is: <b><code>%RELEASEEDITLOCKCHECKBOX%</code></b></td>
175     <td> %RELEASEEDITLOCKCHECKBOX%  </td>
176   </tr>
177   <tr>
178     <td><code>%WEBBGCOLOR%</code></td>
179     <td><strong><em>WL</em></strong></td>
180     <td> Background color of web </td>
181     <td> %WEBBGCOLOR%  </td>
182   </tr>
183   <tr>
184     <td><code>%WEBCOPYRIGHT%</code></td>
185     <td><strong><em>SL</em></strong> , <strong><em>WL</em></strong></td>
186     <td> Copyright notice (bottom right corner of topics) </td>
187     <td> %WEBCOPYRIGHT%  </td>
188   </tr>
189   <tr>
190     <td><code>%WEBTOPICLIST%</code></td>
191     <td><strong><em>WL</em></strong></td>
192     <td> Common links of web (second line of topics) </td>
193     <td> %WEBTOPICLIST%  </td>
194   </tr>
195   <tr>
196     <td><code>%WIKIWEBLIST%</code></td>
197     <td><strong><em>SL</em></strong></td>
198     <td> List of %WIKITOOLNAME% webs (in upper right corner of topics) </td>
199     <td> %WIKIWEBLIST%  </td>
200   </tr>
201   <tr>
202     <td><code>%WIKIWEBMASTER%</code></td>
203     <td><strong><em>SL</em></strong></td>
204     <td> Webmaster email address (sender of email notifications) , is <b></b></td>
205     <td>  </td>
206   </tr>
207 </table>
208
209 **_Note:_** There are some more useful variables defined in the [[TWikiPreferences]] like `%BR%` for line break, colors like `%RED%` for colored text and small icons like `%H%` for a %H% Help icon.
210
211 <a name="SettingPrefs"></a>
212
213 ## <a name="Setting Preferences"></a> Setting Preferences
214
215 - The syntax for Preferences Variables is the same anywhere in TWiki (on its own TWiki bullet line, including nested bullets): <br />[multiple of 3 spaces] \* [space] Set [space] VARIABLENAME [space] = [value]<br />**_Examples:_**
216 - <code>**Set VARIABLENAME = value**</code>
217   - <code>**Set VARIABLENAME = value**</code>
218
219 ## <a name="Creating Custom Variables"></a> Creating Custom Variables
220
221 - You can add your own Preference Variables for us across an entire site or a single web, using the standard [[Preferences syntax|Main/WebHome#SettingPrefs]]. Whatever you include in your Variable will be expanded on display, exactly as if it had been entered directly. You can place formatted text, page links, image paths.
222
223 > **Example: Create a custom logo variable the %WEB% web**
224 >
225 > <br />
226 >
227 > - To place a logo anywhere in a web by typing <code>**%MYLOGO%**</code>, define the Variable on the web's [[WebPreferences]] page, and upload a logo file, ex: `mylogo.gif`. You can upload by [[attaching the file|Main/FileAttachment]] to [[WebPreferences]], or, to avoid clutter, to any other topic in the same web, ex: `LogoTopic`:
228 >   - <code>**Set MYLOGO = %PUBURL%/TWiki/LogoTopic/mylogo.gif**</code>
229
230 -- TWiki:Main.PeterThoeny - 14 Aug 2004 <br /> -- TWiki:Main.MikeMannix - 12 May 2002
231
232 Crawford split up this topic into included [[TWikiVariablesAtoM]] and [[TWikiVariablesNtoZ]].
233
234 -- [[PeterThoeny]] - 26 Jul 2004