Tags:
create new tag
view all tags

Question

Question I am a beginner with TWiki and I very interested in one question.

I create user variable like in example, but I can't get it's value.

%VARIABLE{parameter="value" id="1"}%

When I try to use VARIABLE, I am only see plain text, instead a value:

%VARIABLE{ "parameter" }% %VARIABLE%

I wonder how can I create complicated user variables with many parameters?

Environment

TWiki version: TWikiRelease04x01x00
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS: XP
Web Browser: Explorer
Categories: Documentation

-- SvetlanaGurskaya - 03 Oct 2007

Answer

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.

With TWiki's Set VARNAME = value and %VARNAME% syntax you can only define variables without parameters. The closest thing you can get is to use parametrized %INCLUDE%. See TWiki.VarINCLUDE and TWiki.IncludeTopicsAndWebPages for complete documentation and examples, here's just a quickstart:

  1. You define your variables by creating named sections in a topic of your choice, for example VariablesTopic:
         %STARTSECTION{"ComplicatedVar"}%
         A complex "variable" containing %SOME% %CHANGEABLE% %CONTENT%
         %ENDSECTION{"ComplicatedVar"}%
         
  2. You use your variable by including that section:
         %INCLUDE{"VariablesTopic" section="ComplicatedVar" SOME="very" CHANGEABLE="nice" CONTENT="tricks"}%
         
  3. This will result in the following expansion:
         A complex "variable" containing very nice tricks
         

You can have as many such "variables" with differnt section names as you like, all in one topic or distributed. Be careful not to use names of predefined TWikiVariables for your parameters.

-- HaraldJoerg - 03 Oct 2007

If you know Perl, you can also create a plugin that resolves variables with parameters. See TWikiPlugins.

-- PeterThoeny - 04 Oct 2007

Thank you for you answer!

-- SvetlanaGurskaya - 04 Oct 2007

Change status to:
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2010-03-11 - AlexTuretsky
 
  • 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.