Tags:
create new tag
view all tags

Question

When I put %INCLUDE{}% in a preferences topic defining variables, the variables don't get defined. From the code it looks like %INCLUDE{}% isn't processed in the getPrefsFromTopic routine. I expect to modify the file that gets %INCLUDE{}% ed frequently; is there a better way to accommodate this?

  • TWiki version:01Feb2003
  • Perl version: 5.6.1
  • Web server & version:
  • Server OS: Linux
  • Web browser & version: IE 6
  • Client OS: Win XP

-- TWikiGuest - 09 May 2003

Answer

How about the other way around? Define a TOPIC_TO_INCLUDE prefs variable and %INCLUDE{"%TOPIC_TO_INCLUDE%"}%.

-- PeterThoeny - 16 May 2003

Looks like TWikiGuest tried to do what I asked for in SeparateCustomPreferences. Problem is not that file to include cannot be a variable: Problem is, that variables from included file are not get defined.

-- PeterMasiar - 18 May 2003

I'd like to reopen this if I may. I've been beating my head against this one all day, and this topic describes the problem, but there is no answer (even looking at the link that PeterMasiar gave).

You have a topic SomeTopic which does this

  * Set KEY_SIG = <a href="%SCRIPTURLPATH%/view/Main/USERNAME"> %KEY_LOGO% </a>
  * Set KEY_LOGO = %PUBURL%/Main/USERNAME/filename.jpg

Purpose is to replace
-- RichardWilliamson - 21 Jan 2004 with
-- %KEY_SIG% - 21 Jan 2004 in order to get
-- #ImageThatLinksToMainRichardWilliamson# - 21 Jan 2004

I could put the two Sets into RichardWilliamson, but that would mean that only I would see the way-cool-graphic. Everyone else sees %KEY_SIG%.

To get it into the TWiki preferences so that everyone sees it, I assumed I could do %INCLUDE{"SomeTopic"}% from within TWikiPreferences, and it would capture the Sets from that topic. I'm leary of letting users modify the Twiki Preferences file to add their own .sig logos.

So my questions are, 1) Shouldn't #including a topic with preferences make those preferences active, and why does KEY_SIG not show an image-that-is-a-link instead of the un-modified %KEY_LOGO% variable?

rip

Version: 01 Feb 2003
Release type: Production release
steen 16:18 [httpd/twiki] rip>uname -a
Linux steen 2.4.23-xfs #3 SMP Fri Dec 12 18:33:24 GMT 2003 i686 unknown
steen 16:18 [httpd/twiki] rip>

-- RichardWilliamson - 21 Jan 2004

Since this is my first post, I just want to start off by thanking all the contributors to this wonderful endeavour called TWiki. I have become a devoted fan.

Regarding the topic at hand, I have also run into the same issues described by RichardWilliamson and was wondering if anyone had found a way around this.

-- SergeArsenault - 08 Apr 2005

I would like re-re-open this question.

This seems like a really key bit of functionality that I'd like to work. I have regression test results on a different machine which I'd like to pass to my web as variables. If include doesn't work can anyone suggest another way of doing this? Thanks.

-- TWikiGuest - 27 Apr 2006

You should be able to use a %CALC{$SET(myvar, blah)}% in an included text, and re-use/modify/display that in your topic (after the include.) See SpreadSheetPlugin.

See also related IncludeFilesAsURL.

-- PeterThoeny - 28 Apr 2006

Thanks Peter.

Using: %CALC{$SET(myvar, blah)}% and %CALC{$GET(myvar, blah)}% works.

I hope a proper fix can find it's way into a release as I'm sure lots of people get caught out by this and the workaround is non-obvious for a novice user.

-- TWikiGuest - 02 May 2006

Using SpreadSheetPlugin is the only way to include preferences into TWikiPreferences. In otherwords, putting NatSkin prefs into the include means i have to to %CALC% jig for every included Pref. Say it isn't still so... smile

-- BreckAuten - 23 Dec 2006

Further info, If I include in TWikiPreferences the NatSkin Prefs don't take effect and it defaults to 'Clean', however, if I view my Topic containing the Prefs then the NatSkin Prefs work wonderful.

I hope that wasn't a ClearAsMud description.

-- BreckAuten - 23 Dec 2006

Found TWiki:Support.FileOfWebVariables vintage 2005, it says Preferences do not follow INCLUDES. If this has changed let know.

IncludeFailsForPrefs really didn't spell out the fact it may be a design decision.

Later.

-- BreckAuten - 23 Dec 2006

It hasn't changed: If you %INCLUDE{...}% a topic, the preferences within that topic are not taken into account. Allowing to change this behaviour has been on the shopping list for TWiki4 (See IncludeShouldIncludeSettings), but it turned around that there are lots of border cases which must be specified - so it was discarded.

-- HaraldJoerg - 23 Dec 2006

I may be seeing things, but I created a NatSkinConfiguration topic that had 3 lines that included TWikiNatSkinConfiguration topic mainly because I am having search problems so I couldn't delete NakSkinConfiguration.

Rendered the Set vars fine. Why did i work there?

Merry Christmas.

-- BreckAuten - 25 Dec 2006

Another instance where this is useful:

We have a configuration file for the nagios nrpe agent that is a global configuration. However, you need to specify two items in it. The server IP of the nagios server in the tier and the IP of the server the nrpe agent is running on.

What we tried to do was create the config with two variables in place of those items. Then we create a seperate doc for each tier that includes in the global config and sets one of the variables. Then in each server build doc, we include in the tier specific doc and set the last variable. This way, if the nagios server IP was to change, we only have to change one document.

-- StevenHajducko - 24 Apr 2007

Bug report filed Bugs:Item4546

-- VickiBrown - 04 Sep 2007

Feature proposal: Codev.INCLUDEdSetvariablesshouldwork

-- VickiBrown - 07 May 2008

Edit | Attach | Watch | Print version | History: r19 < r18 < r17 < r16 < r15 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r19 - 2008-05-07 - VickiBrown
 
  • 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.