Creating Tables
Tables are often needed for organizing information. Tiki has a simple syntax for defining a table. In Wiki pages and other contexts that support Wiki formatting (including articles, forums, and blogs), you can create simple tables. A table can be entered using two alternative syntaxes; your administrator chooses which one is enabled. Both use the pipe symbol (|, above the \ on most PC keyboards) to separate table columns. A double pipe (||) starts and ends the table in both types of syntax.
if || is the row delimiter, then table rows are separated by double pipes (||), just as at the beginning and end of the table:
||row1-column1|row1-column2||row2-column1|row2-column2||
produces
row1-column1 | row1-column2 | |
row2-column1 | row2-column2 |
if, on the other hand, a newline is the row delimiter, then each line in the Wiki box represents a row in the table. So,
||row1-column1|row1-column2
row2-column1|row2-column2||
produces
row1-column1 | row1-column2 | |
row2-column1 | row2-column2 |
Spanning Across Columns
You can span across multiple columns (colspan) in a row with the following syntax:
||row1-column1|row1-column2|row1-column3||row2-columns123||row3-column1|row3-columns23||
or
||row1-column1|row1-column2|row1-column3
row2-columns123
row3-column1|row3-columns23||
produces
row1-column1 | row1-column2 | row1-column3 |
row2-columns123 | ||
row3-column1 | row3-columns23 |
Note that partial column spanning only occurs in the last columns of a table. For instance, there is no way to span across the first two columns of a three column table.
Line Breaks
If you need to have multiple rows in a single cell of a table, use three percent signs to create line breaks, like this (using the newline delimiter):
||Sample Table
row1-col1|row1-col2%%%second line%%%third line|row1-col3
row2-col1|row2-col2|row2-col3%%%second line||
or
||Sample Table||row1-col1|row1-col2%%%second line%%%third line|row1-col3||row2-col1|row2-col2|row2-col3%%%second line||
produces:
Sample Table | ||
row1-col1 | row1-col2%%%second line third line | row1-col3 |
row2-col1 | row2-col2 | row2-col3%%%second line |
At present, if a field ends with a line break it is ignored. To work around this behavior of trailing line breaks, use two line breaks: "%%% Name %%% %%%" will produce "Name" with one empty line above and below.
Centering Table Text
To center any text, including text in a table, use two colons before and two colons after:
::This text is centered.::
produces:
||::Sample Table::
row1-col1|row1-col2
row2-col1|row2-col2||
produces:
Sample Table
| ||
row1-col1 | row1-col2 | |
row2-col1 | row2-col2 |
Centered Tables
To center a table itself, the structure gets a bit more complicated, because browsers don't follow the same rules, and what works for one does not work for another. To insert a simple table centered, use this:
{BOX(align=>center)}||row1-col1|row1-col2
row2-col1|row2-col2||{BOX}
to produce:
row1-col1 | row1-col2 | |
row2-col1 | row2-col2 |
At this time, both the box and the table have a border; this should be corrected in a future release, or tables will allow an align property.
Alternative:
To center a table, you could simply the CENTER tag:
{TAG(tag=center)} ||row1-col1|row1-col2 row2-col1|row2-col2|| {TAG}
to produce:
row1-col1 | row1-col2 | |
row2-col1 | row2-col2 |
))Right-Aligned(( Tables
If you need to right-align a table itself, you must use a DIV structure, and you must use both the align and float commands, or IE users won't see it aligned correctly. Use this:
{DIV(class=>class, type=>div, align=>right, float=>right)}||::Sample Table::
row1-col1|row1-col2
row2-col1|row2-col2||{DIV}
to produce:
Sample Table
| ||
row1-col1 | row1-col2 | |
row2-col1 | row2-col2 |
Help!
- If you see the WikiSyntax for your table instead of your table, check for newlines. Pressing Enter in the middle of a table will cause the table to break up, if || table mode is enabled.
Visit the SandBox and try it!