Pass data from an INCLUDEd topic

  • Tip Category - Developing Wiki Applications
  • Tip Added By - RichMorin - 29 Sep 2009 - 20:58
  • Extensions Used - SpreadSheetPlugin
  • Useful To - Beginners
  • Tip Status - New
  • Related Topics -


You want to pass data to the current topic from an INCLUDEd topic.


The included topic collects and/or generates some information. The including topic needs to get access to the data, for further scripting. Ordinary user-defined TML variables are not returned from included files. (This is considered to be a "feature")


There are at least two ways to do this; both use SpreadSheetPlugin.


SpreadSheetPlugin's variables are accessible by the calling topic. So, you can use $SET in the included topic:
%CALC{"$SET(Bar, 21)"}% 
%CALC{"$SET(Foo, 42)"}% 

and $GET in the including topic:
%CALC{"$GET(Bar)"}% is less than %CALC{"$GET(Foo)"}%.

This should yield: 21 is less than 42.

Generate a (hidden) table

SpreadSheetPlugin is able to extract data from the most recent table in the current topic. So, have the included topic generate a table:
| Bar | 21|
| Foo | 42|

Now hide it and then extract data from it.
%CALC{"$T(R1:C2)"}% is less than %CALC{"$T(R2:C2)"}%.

This should yield: 21 is less than 42.

Known Uses

These techniques can be used both within the context of a wiki and when the included page is on another (eg, PHP) server.

Known Limitations

Complex and non-intuitive.

See Also

BestPracticeTipsForm edit

Category Developing Wiki Applications
Related Topics
Topic revision: r5 - 22 Jul 2013, MichaelDaum - This page was cached on 13 Jan 2018 - 18:49.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License