Tags:
create new tag
view all tags

SID-01116: Inserting table content from external text

Status: Answered Answered TWiki version: 5.0.1 Perl version:
Category: CategoryEditing Server OS: Linux Ubuntu 2.6.35-25 Last update: 14 years ago

Hello All,

I wrote my data analysis program to output results as a Twiki formatted table and this is written to a file. Say table.dat.

Assume that the content of the table.dat is like this:

|           |*Expt 1*|*Expt 2*|*Expt 2*|
|Run1  | 1         | 2           | 3         |
|Run 2 | 2         | 4           | 5        |

I would like to include this table to be included in the Twiki web page automatically. Sure, I could cut and paste it in the wiki editor, but the next time I run the data analysis program, the data has changed and I have to manually edit the Twiki page.

Is there something like %INCLUDE{...}% variable that will read in twiki formatted data from an external source and render it? So I ideally I would have something like

%INCLUDE_TWIKI_CODE{"http://myserver/table.dat"}% on my main TWiki page and it would automatically draw the table if the data changes.

Thanks Karthik

-- KarthikB - 2011-02-23

Discussion and Answer

Name your file table.txt for proper MIME type detection and %INCLUDE{http://example.com/table.txt}%. Disadvantage: Your table data is not version controlled.

Alternative solutions:

  • Put your Table.txt file directly into the twiki/data/ directory tree in a web.
    • Advantage: Access the data like any other topic.
    • Disadvantage: No version crontrol; need access to TWiki server file system; be careful not to overwrite existing topics.
  • Push content via http using tools like CPAN:LWP::UserAgent, CurlTool Curl or WwwMechanize.
    • Advantage: Content is version controlled.
    • Disadvantage: More time to implement.

Related: VarINCLUDE

-- PeterThoeny - 2011-02-23

      Change status to:
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.
SupportForm
Status Answered
Title Inserting table content from external text
SupportCategory CategoryEditing
TWiki version 5.0.1
Server OS Linux Ubuntu 2.6.35-25
Web server Apache
Perl version

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2011-02-23 - PeterThoeny
 
  • 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.