• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

See test page IncludeVarInIncludeSectionTest: the variable TOPICNAME is passed to the included section (or topic) but not recognized by the IF statement.


No, that's not true. You are (understandably) confused about the evaluation order.

When a topic is included, the content of that topic is placed in-line into the including topic. Any INCLUDE parameters are expanded at that time, so the text embedded in the including topic will have %TOPICNAME% expanded. However %IF statements are not expanded. So your %IF{"defined TOPICNAME is evaluated in the context of the including topic, where %TOPICNAME is not defined.

You can either define TOPICNAME in the including topic

    * Set TOPICNAME =
or you can test the expanded variable name in the included topic
%IF{"'%TOPICNAME%'!=''" then="defined" else="not defined"}%
in the included topic.



I have updated the test but cannot get %TOPICNAME% evaluate to empty string.


I've solved my problem in a slightly different way by passing a ('boolean') value PREFILLTOPIC='1' to the included section. This is easier to test.

Nevertheless it would be nice if a solution to this Bug could be added to IncludeTopicsAndWebPages.


It is not a bug - IF defined works the way it is documented. Discarding.


Summary IF defined does not work with parameterised INCLUDEs
ReportedBy TWiki:Main.ArthurClemens

SVN Range Mon, 27 Mar 2006 build 9563
AppliesTo Engine

Priority Normal
CurrentState No Action Required


TargetRelease n/a
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r7 - 2006-04-27 - CrawfordCurrie
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback