Server side
%INCLUDE%
has now these improvements:
Prevent infinite recursion
The previous version had a quick hack to prevent infinite includes by limiting includes up to 10 levels. TWiki keeps now track of the files that have been included and prevents infinite recursions.
New variables for better include handling
New variables
%BASEWEB%
,
%INCLUDINGWEB%
,
%BASETOPIC%
,
%INCLUDINGTOPIC%
have been introduced to have more control over include handling:
Variable: |
New: |
What it is: |
|
|
|
%WEB% |
No |
The web name where the current topic is located. |
%BASEWEB% |
Yes |
The web name where the includes started, e.g. the web of the first topic in the include hierarchy. Same as %WEB% in case there is no include. |
%INCLUDINGWEB% |
Yes |
The web name of the topic that includes the current topic. Same as %WEB% in case there is no include. |
|
|
|
%TOPIC% |
No |
The current topic name. |
%BASETOPIC% |
Yes |
The name of the topic where the includes started, e.g. the first topic in the include hierarchy. Same as %TOPIC% in case there is no include. |
%INCLUDINGTOPIC% |
Yes |
The name of the topic that includes the current topic. Same as %TOPIC% in case there is no include. |
How can this be used?
- Create generic topics that behave the same regardless in what web they are located in.
- Example: Change the WebSearch topic in Main to have
%INCLUDINGWEB%
instead of %WEB%
. Now replace the WebSearch topic in other webs to have just this one line: %INCLUDE{Main.WebSearch}%
. Like this you can make changes to the one master WebSearch and all other topics are updated automatically.
Both improvements and fix for
IncludePrependsWebNameForWikiWords have been commited to
TWikiAlphaRelease.
--
PeterThoeny - 04 Dec 2000