I have the following code in my TWiki/WebTopBar
* %IF{ "$action~'*Hide*'" then="$percentINCLUDE{\"Help/HideWebLeftBar\"}$percent" }%
<form name="hideshow" action="%SCRIPTURLPATH{"view"}%/%INCLUDINGWEB%/%INCLUDINGTOPIC%" method="get">
<input type="hidden" name="hideleftbar" value="1" />
<input type="image" src="%PUBURL%/%USERSWEB%/DocumentGraphics/%IF{ "$action~'*Hide*'" then="showleftbar.png" else="hideleftbar.png" }%" title="%IF{ "$action~'*Hide*'" then="Show Left Bar" else="Hide Left Bar" }%" name="action" value="%IF{ "$action~'*Hide*'" then="Show Left Bar" else="Hide Left Bar" }%" />
</form>
The code runs when I click on the image. However, the conditional INCLUDE does not work as expected/documented.
ref:
IfStatements
, Examples,
11. Conditional include
%IF{"'%USERNAME%' ingroup 'ExecutiveGroup'" then="$percntINCLUDE{ExecutiveReport}$percnt"}%
When the first
IF
fires (i.e. when
$action~'*Hide*'
) instead of including
Help/HideWebLeftBar
, it
prints the string
$percentINCLUDE{\"Help/HideWebLeftBar\"}$percent
see:
http://www.cfcl.com/twiki6/bin/view/System/WebTopBar
for this code i_in situ_
--
TWiki:Main/VickiBrown
- 2014-03-18
It prints
$percentINCLUDE
because the syntax is
$percnt
, not
$percent
.
--
TWiki:Main.PeterThoeny
- 2014-03-18
I'm so embarrassed!
(
Ken Thompson was once asked what he would do differently if he were redesigning the UNIX system. His reply: "I'd spell creat with an e.")
--
TWiki:Main.VickiBrown
- 2014-03-26