|
META TOPICPARENT |
name="WebHome" |
|
|
- WebTopicEditTemplate in the current web
- WebTopicEditTemplate in the TWiki web
|
|
> > | Edit Template Topics and Variable Expansion
The following variables get expanded when a user creates a new topic based on a template topic:
Variable: |
Description: |
%DATE% |
Current date, e.g. 2025-03-13 |
%WIKIUSERNAME% |
User name, e.g. Main.TWikiGuest |
%URLPARAM{"name"}% |
Value of a named URL parameter |
%NOP% |
A no-operation variable that gets removed. Useful to prevent a SEARCH from hitting an edit template topic; also useful to escape a variable like %URLPARAM%NOP%{...}% |
%NOP{ ... }% |
A no-operation text that gets removed. Useful to write-protect an edit template topic, but not the topics based this template topic. See notes below. Example: %NOP{ * Set ALLOWTOPICCHANGE = Main.TWikiAdminGroup }% |
Notes:
- Unlike other variables,
%NOP{ ... }% can span multiple lines.
- The scan for the closing
}% pattern is "non-greedy", that is, it stops at the first occurance. That means, you need to escape variables with parameters located inside %NOP{ ... }% : Insert a %NOP% between } and % . Silly example: %NOP{ %GMTIME{"$year"}%NOP%% }% .
All other variables are unchanged, e.g. are carried over "as is" into the new topic. |
| Template Topics in Action
Here is an example for creating new topics based on a specific template topic: |
|
- A drawback of referring to a master template is that you can only test a template from within TWiki, where the include variables are resolved. In the previous system, each template was a structurally complete HTML document with a
.tmpl filename extension - it contained unresolved %VARIABLES% , but could still be previewed directly in a browser.
|
|
< < | -- PeterThoeny - 23 Jul 2001
|
> > | -- PeterThoeny - 01 Feb 2003
|
| -- MikeMannix - 14 Sep 2001
-- TWiki:Main/DavidLeBlanc - 11 Mar 2002
META FILEATTACHMENT |
attr="h" comment="Example of oopstest.tmpl rendered" date="1026977240" name="testscreen.gif" path="C:\Data\Temp\testscreen.gif" size="9566" user="PeterThoeny" version="1.2" |
|