Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
TWiki Templates | ||||||||
Line: 115 to 115 | ||||||||
view and edit respectively. The template search order is as specified above. | ||||||||
Added: | ||||||||
> > | Both VIEW_TEMPLATE and EDIT_TEMPLATE may contain TWiki variables, which are expanded.
For example, the following setting causes Item* topics to be displayed with the custom view template ItemViewTmpl while the other topics are displayed normally.
* Set VIEW_TEMPLATE = %IF{"'%CALCULATE{$SUBSTRING(%TOPIC%, 1, 4)}%' = 'Item'" then="ItemViewTmpl"}%The following setting causes Item* topics to be edited with the editform template (edits only the TWiki form of the topic without editing the topic text) while the other topics are edited normally.
* Set EDIT_TEMPLATE = %IF{"'%CALCULATE{$SUBSTRING(%TOPIC%, 1, 4)}%' = 'Item'" then="editform"}% | |||||||
![]() {TemplatePath} so that another directory, such as the %USERSWEB% appears at the front. You can then put your own templates into that directory or web and these will override the standard templates. (Note that such will increase the lookup time for templates by searching your directory first.)
| ||||||||
Line: 255 to 265 | ||||||||
See TWikiScripts for information about all the other parameters to edit .
| ||||||||
Changed: | ||||||||
< < | Automatically Generated Topic Names | |||||||
> > | Automatically Generated Unique Topic Names | |||||||
For TWiki applications it is useful to be able to automatically generate unique topic names, such as BugID0001, BugID0002, etc. You can add AUTOINC<n> to the topic name in the edit and save scripts, and it will be replaced with an auto-incremented number on topic save. <n> is a number starting from 0, and may include leading zeros. Leading zeros are used to zero-pad numbers so that auto-incremented topic names can sort properly. Deleted topics are not re-used to ensure uniqueness of topic names. That is, the auto-incremented number is always higher than the existing ones, even if there are gaps in the number sequence. | ||||||||
Line: 276 to 286 | ||||||||
Create new item | ||||||||
Added: | ||||||||
> > | Note: After the save operation, the web client is redirected to the newly created topic by default. If the specified topic name contains AUTOINC<n> and you want to redirect to a different URL containing the newly created topic's name, you can use AUTOINC in the redirectto parameter. Let's say the specified topic name is ItemAUTOINC0001 , and redirectto is set to %SCRIPTURL{view}%/%WEB%/ViewerTopic?id=ItemAUTOINC . If the latest existing topic is Item0123 , a new topic named Item0124 is created, and the web client is redirected to ViewerTopic?id=Item0124 in the current web. | |||||||
Template Topics in Action |