SID-01972: Using variables in a table
| Status: |
Answered |
TWiki version: |
5.1.1 |
Perl version: |
|
| Category: |
CategoryRendering |
Server OS: |
|
Last update: |
11 years ago |
I want to display variables within the cells of a table.
This is easy to do in the editor, raw or WYSIWYG.
But the expanded content gets displayed outside of the table.
How do I force the table to re-size appropriately?
--
TWiki Guest - 2014-09-18
Discussion and Answer
For example:
| Table of Contents |
Hierarchy |
| %TOC% |
%INCLUDE{"%SYSTEMWEB%.HierarchicalNavigation" section="all"}% |
--
TWiki Guest - 2014-09-18
It depends on the variable if it is possible to embed it in a TWiki table or not. If the variable has newlines when expanded it will break a TWiki table because TWiki variables are expanded before the TWiki rendering (headings, bullets, tables, etc), and a TWiki table row cannot span multiple lines. That is, as long as the variable does not return a newline it will work in TWiki tables.
You can tell INCLUDE to convert newlines to line breaks by using a
newline="$br" parameter. This requires TWiki-6.0. Details at
VarINCLUDE.
If you want to use variables that have newlines in tables you need to use HTML tables instead of TWiki tables.
--
Peter Thoeny - 2014-09-19
Thanks Peter. HTML tables work.
But I now have a related problem - see SID-01973.
--
Ben Kinsella - 2014-09-19
I replied in
SID-01973 on how to preserve HTML tables, e.g. prevent the WYSIWYG editor from changing HTML back to TML.
--
Peter Thoeny - 2014-09-19
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.