Welcome, Registration, and other StartingPoints; TWiki history & Wiki style; All the docs...
View   r22  >  r21  >  r20  >  r19  >  r18  >  r17  ...
TWikiTemplates 22 - 25 Apr 2004 - Main.PeterThoeny
Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Line: 95 to 95
 
Variable: Description:
%DATE% Current date, e.g. 01 Dec 2024
Changed:
<
<
%WIKIUSERNAME% User name, e.g. Main.TWikiGuest
>
>
%USERNAME% Login name, e.g. jsmith
%WIKINAME% WikiName of user, e.g. JohnSmith
%WIKIUSERNAME% User name, e.g. Main.JohnSmith
 
%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
}%
Line: 250 to 252
 
  • 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:
<
<
-- TWiki:Main.PeterThoeny - 30 Dec 2004
>
>
-- TWiki:Main.PeterThoeny - 25 Apr 2004
 -- TWiki:Main.MikeMannix - 14 Sep 2001
-- TWiki:Main.DavidLeBlanc - 11 Mar 2002
Added:
>
>
 
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"
META TOPICMOVED by="MikeMannix" date="1000277381" from="TWiki.TWikiTemplateSystem" to="TWiki.TWikiTemplates"

TWikiTemplates 21 - 31 Dec 2003 - Main.PeterThoeny
Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Line: 117 to 117
 
Added:
>
>
  (date format is YYYYxMMxDD)
Line: 130 to 131
  <input type="hidden" name="templatetopic" value="ExampleTopicTemplate" /> <input type="hidden" name="topicparent" value="%TOPIC%" /> <input type="hidden" name="onlywikiname" value="on" />
Added:
>
>
<input type="hidden" name="onlynewtopic" value="on" />
  <input type="submit" value="Create" /> (date format is <nop>YYYYxMMxDD) </form>
Line: 141 to 143
 
Parameter: Description:
topic Name of topic to create. Can be set in a text field, or is set programmatically (e.g. with a sequential number)
onlywikiname If set, TWiki will complain if the topic name is not a WikiWord
Added:
>
>
onlynewtopic If set, TWiki will complain if a topic of the same name already exists
 
templatetopic The name of the template topic, e.g. topic used to copy the initial content
topicparent Sets the parent topic
TopicClassification Assuming the template topic has a form with a field called "TopicClassification", it will set the value of the field
Line: 247 to 250
 
  • 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:
<
<
-- TWiki:Main.PeterThoeny - 16 Dec 2003
>
>
-- TWiki:Main.PeterThoeny - 30 Dec 2004
 -- TWiki:Main.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"

TWikiTemplates 20 - 16 Dec 2003 - Main.PeterThoeny
Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Line: 135 to 135
 </form>
Changed:
<
<
The onlywikiname parameter enforces WikiWords for topic names. The topicparent parameter sets the topic parent to the topic where the form is located.
>
>
The edit scipt understands the following parameters, typically supplied by HTML input fields:

Parameter: Description:
topic Name of topic to create. Can be set in a text field, or is set programmatically (e.g. with a sequential number)
onlywikiname If set, TWiki will complain if the topic name is not a WikiWord
templatetopic The name of the template topic, e.g. topic used to copy the initial content
topicparent Sets the parent topic
TopicClassification Assuming the template topic has a form with a field called "TopicClassification", it will set the value of the field
anyname Any parameter can passed to the new topic; if the template topic contains %URLPARAM{"anyname"}%, it will be replaced by its value
 TIP TIP: You can use the %WIKIUSERNAME% and %DATE% variables in your topic templates to include the signature of the person creating a new topic. The variables are expanded into fixed text when a new topic is created. The standard signature is:
-- %WIKIUSERNAME% - %DATE%
Line: 237 to 247
 
  • 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 - 01 Feb 2003
-- MikeMannix? - 14 Sep 2001
-- TWiki:Main/DavidLeBlanc - 11 Mar 2002
>
>
-- TWiki:Main.PeterThoeny - 16 Dec 2003
-- TWiki:Main.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"
META TOPICMOVED by="MikeMannix" date="1000277381" from="TWiki.TWikiTemplateSystem" to="TWiki.TWikiTemplates"

TWikiTemplates 19 - 02 Apr 2003 - Main.PeterThoeny
Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Line: 115 to 115
 
  • New example topic:
Added:
>
>
  (date format is YYYYxMMxDD)
Line: 126 to 128
 
  • New example topic: <input type="text" name="topic" value="ExampleTopic%SERVERTIME{$yearx$mox$day}%" size="23" /> <input type="hidden" name="templatetopic" value="ExampleTopicTemplate" />
Added:
>
>
<input type="hidden" name="topicparent" value="%TOPIC%" />
  <input type="hidden" name="onlywikiname" value="on" /> <input type="submit" value="Create" /> (date format is <nop>YYYYxMMxDD) </form>
Changed:
<
<
The onlywikiname parameter enforces WikiWords for topic names.
>
>
The onlywikiname parameter enforces WikiWords for topic names. The topicparent parameter sets the topic parent to the topic where the form is located.
 TIP TIP: You can use the %WIKIUSERNAME% and %DATE% variables in your topic templates to include the signature of the person creating a new topic. The variables are expanded into fixed text when a new topic is created. The standard signature is:
-- %WIKIUSERNAME% - %DATE%

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. 01 Dec 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 22r22 - 25 Apr 2004 - 07:07:38 - PeterThoeny?
Revision 21r21 - 31 Dec 2003 - 07:29:57 - PeterThoeny?
Revision 20r20 - 16 Dec 2003 - 08:19:00 - PeterThoeny?
Revision 19r19 - 02 Apr 2003 - 08:24:51 - PeterThoeny?
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