Welcome, Registration, and other StartingPoints; TWiki history & Wiki style; All the docs...
View   r18  >  r17  ...
TWikiTemplates 18 - 01 Feb 2003 - Main.PeterThoeny
Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Line: 88 to 88
 
  1. WebTopicEditTemplate in the current web
  2. WebTopicEditTemplate in the TWiki web
Added:
>
>

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. 02 May 2024
%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:

Line: 215 to 234
 
  • 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.
Changed:
<
<
-- 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"

Revision 18r18 - 01 Feb 2003 - 12:46:00 - PeterThoeny?
Revision 17r17 - 08 Jan 2003 - 07:13:12 - PeterThoeny?
This site is powered by the TWiki collaboration platform.
All material on this collaboration platform is the property of the contributing authors.
All material marked as authored by Eben Moglen is available under the license terms CC-BY-SA version 4.
Syndicate this site RSSATOM