Tags:
create new tag
, view all tags

Question

Hi. I am unable to get a basic %IF{"defined VARIABLE"... to recognise that a variable is set. I have tried :

%IF{"defined TOPIC" then="TOPIC is defined" else="TOPIC is not defined"}%
I have tried many variations, defining variables locally in the topic etc. What I really want to do is pass a variable in via a topic %INCLUDE%, but it seems that even the basic defined check is always returning false. Am I doing something stupid ? I have checked & re-checked the documentation.

Thanks for any help.

Environment

TWiki version: TWikiRelease04x00x05
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: RH7.2
Web server: apache 1.3
Perl version: 5.6.0
Client OS: XP
Web Browser: Firefox 2.0
Categories: Platform

-- SteveJonesST - 27 Feb 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

No, there is a Bug entry outstanding, Bugs:Item3620. TOPIC does not get evaluated the same way as other variables.

-- ArthurClemens - 27 Feb 2007

Ah, that's interesting, but in fact this is just disguising my real problem. The real issue is that defined is returning false even when a variable is passed in correctly using a parameterised %INCLUDE%. Here's my testcase :

I have a topic which contains this :

%IF{"defined category" then="category is defined" else="category is not defined"}%

category is %category%

I include it with this :

%INCLUDE{"SteveJonesIncludeTest" category="DSM"}%

I get the the following rendered :


category is not defined

category is DSM


So I know the value 'DSM' is being passed in via the variable 'category', as it's being rendered correctly, however, the check to see if the variable 'category' is defined is failing.

Arthur, I guess you know that I am trying to get the BlogAddOn working as intended on our site, and this is what's blocking us.

Thanks for any insight.

-- SteveJonesST - 27 Feb 2007

So what's your real problem? To not show posts that do not have a category?

-- ArthurClemens - 27 Feb 2007

Sorry for being unclear. My real problem is that the category value is ignored, and I always see all posts, because the value of 'category' passed in always fails the defined check, even if the value is defined properly.

If I pass the value of category in via the URL directly, everything works as expected, but if I pass the value in via the %INCLUDE% mechanism, the defined check fails, and I see posts in all categories.

I can see that this is not related to your AddOn, but to my installation, which is why I raised it here. As it turns out, you're helping me anyway, which I really appreciate.

-- SteveJonesST - 27 Feb 2007

Closing this question after more than 30 days. Please re-open if needed...

-- PeterThoeny - 02 Apr 2007

 
Change status to:
Topic revision: r6 - 2007-04-02 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.