Tags:
create new tag
view all tags

SID-01888: Conditional INCLUDE not working as expected

Status: Answered Answered TWiki version: 6.0.0 Perl version:
Category: CategoryApplications Server OS: Mac OS X Last update: 11 years ago

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.

When the first IF fires (i.e. when $action~'*Hide*') instead of including Help/HideWebLeftBar, it prints the string

$percentINCLUDE{\"Help/HideWebLeftBar\"}$percent

ref: http://www.cfcl.com/twiki6/bin/view/System/WebTopBar

-- Vicki Brown - 2014-03-12

Discussion and Answer

Not sure. In any case, I think it is better to use some jQuery magic to toggle the sidebar. This is much faster because there is no need for a server round-trip.

-- Peter Thoeny - 2014-03-13

If I was a lot better at JQuery, that might make sense. But the code runs in Foswiki (and I like pure TWiki examples. smile

Given that this use of INCLUDE is documented in If Statements, I think this is a bug.

Bugs:Bugs/Item7463

-- Vicki Brown - 2014-03-18

It prints $percentINCLUDE because the syntax is $percnt, not $percent.

-- Peter Thoeny - 2014-03-18

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Conditional INCLUDE not working as expected
SupportCategory CategoryApplications
TWiki version 6.0.0
Server OS Mac OS X
Web server

Perl version

Browser & version

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2014-03-18 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.