Question
In
TWikiPreferences I am trying to make variables to lighten the code user's have to input to achieve their desired look / feel of the pages they create. One problem I am having is inserting 2 different variables in another variable.
For example I am trying to make this variable called:
INDEX = %INDEX2%%INDEX3%
Which will then initialize the following two lines of code:
* Set INDEX2 = %TREEBROWSER{"file" title="[[%HOMETOPIC%][%INCLUDINGWEB% Web Home]]" shared="left"}%
* Set INDEX3 = %TREE{topic="%TOPIC%" formatting="outline" format="* [[$topic][$spacetopic]]" levelprefix=" " startlevel="1"}%
However, the variable
Warning: Can't find topic Support.DynaIndex
will only execute the %INDEX3% variable when I view a page. I have tried putting %INDEX2% and %INDEX3% together and it simply does not work.
To get this to work now - I must enter on a page:
%INDEX2%
%INDEX3%
This makes me think that there is some issue with the formatting of my
%INDEX% = %INDEX2%%INDEX3% variable.
Please let me know if you have any ideas on how to fix this.
Your help is greatly appreciated!
Environment
--
BrianMahoney - 02 Aug 2007
Answer
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.
While I can not completely explain your observation, I can at least supply some bits:
Concatenation of variables "normally" just works. It is a really weird effect of execution order with
plugin variables which hits you here. The variable
%TREEBROWSER{...}% isn't just something which is replaced by something else, it operates on the following text, which always makes things difficult. I'm taking for granted that you wrote
* Set INDEX = %INDEX2%%INDEX3%
instead of the bogus
%INDEX% = INDEX2%%INDEX3% because I could reproduce the behaviour which you are describing.
I could get another unsatisfactory result by using the syntax which usually can be used to define a multiline variable:
* Set INDEX = %INDEX2%
%INDEX3%
Maybe someone with more knowledge about the internals of TreeBrowserPlugin can look at this, I'm totally lost at this code....
--
HaraldJoerg - 02 Aug 2007
Yes, thats correct harald I wrote
INDEX and not %INDEX%
Sorry for the typo. Thank you again for all your efforts to help me!
--
BrianMahoney - 03 Aug 2007
Looks like it needs an actual newline character between TREEBROWSER and TREE. I was looking at some
TWikiVariables to see if I could use one of them but could not find anything convenient maybe we need a %NEWLINE% variable.
--
StephaneLenclud - 08 Aug 2007
As a workaround you can use include instead of variables.
--
StephaneLenclud - 08 Aug 2007
Actually you can even define your include in a variable.
* Set INDEX = %INCLUDE{"DynaIndex"}%
--
StephaneLenclud - 08 Aug 2007
Thanks I'll give it a try
--
BrianMahoney - 08 Aug 2007
Doesn't seem to work I get the same error that shows up on this page. Thanks for trying!
--
BrianMahoney - 08 Aug 2007
Sorry, closing this after more than 30 days of inactivity. Please feel free to reopen.
--
PeterThoeny - 02 Oct 2007