History: Wiki-Syntax Tables
Source of version: 18 (current)
Copy to clipboard
# Wiki-Syntax Tables ## Creating Tables with Wiki Syntax Tables are often needed for organizing data information. Tiki has a simple syntax for defining a table. In Wiki pages and other contexts that support Wiki formatting (including ((Articles)), ((Forums)), and ((Blog))), you can create simple tables. A table can be entered using two alternative delimiters (separators) for the rows; your administrator chooses which one is enabled. Both use the pipe symbol (or a vertical bar "|", above the "\\" on most PC keyboards) to separate table columns. A double pipe (~np~"||"~/np~) starts and ends the table in both types of syntax. If `~np~||~/np~` is the row delimiter, then table rows are separated by double pipes (~np~"||"~/np~), just as at the beginning and the end of a table: {CODE(colors=n)}||row1-column1|row1-column2||row2-column1|row2-column2||{CODE} 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, {CODE()}||row1-column1|row1-column2 row2-column1|row2-column2||{CODE} produces the same table: | 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: ~np~||row1-column1|row1-column2|row1-column3||row2-columns123||row3-column1|row3-columns23||~/np~ or ~np~||row1-column1|row1-column2|row1-column3~/np~ ~np~row2-columns123~/np~ ~np~row3-column1|row3-columns23||~/np~ 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. --- ### Fancytable Use ((PluginFancytable)) to create sortable and good looking tables. Code : {CODE()}{FANCYTABLE(head="row1-column1|row1-column2")} row2-column1|row2-column2 {FANCYTABLE}{CODE} Produces : {FANCYTABLE(head="row1-column1|row1-column2")} row2-column1|row2-column2 {FANCYTABLE} ## 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: ~np~||Sample Table~/np~ ~np~row1-col1|row1-col2%%%second line%%%third line|row1-col3~/np~ ~np~row2-col1|row2-col2|row2-col3%%%second line||~/np~ produces: | Sample Table | |---| | row1-col1 | row1-col2%%%second line<br />third line | row1-col3 | | row2-col1 | row2-col2 | row2-col3%%%second line | --- ## Centering Table Text To center any text, including text in a table, use two colons before and two colons after: ~np~::This text is centered.::~/np~ produces: {DIV(style='text-align: center')}This text is centered.{DIV} ~np~||::Sample Table::~/np~ ~np~row1-col1|row1-col2~/np~ ~np~row2-col1|row2-col2||~/np~ produces: | {DIV(style='text-align: center')}Sample Table{DIV} | |---| | row1-col1 | row1-col2 | | row2-col1 | row2-col2 | --- ## Positioning tables in a page ### Centered Tables Use ((plugincenter)). Code : {CODE()}{CENTER()}||Sample Table row1-col1|row1-col2 row2-col1|row2-col2||{CENTER}{CODE} Produces : {CENTER()}| Sample Table | |---| | row1-col1 | row1-col2 | | row2-col1 | row2-col2 | {CENTER} ### ~np~Right-Aligned~/np~ 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: ~np~{DIV(class=>class, type=>div, align=>right, float=>right)}||::Sample Table::~/np~ ~np~row1-col1|row1-col2~/np~ ~np~row2-col1|row2-col2||{DIV}~/np~ to produce: {DIV(class=>class, type=>div, align=>right, float=>right)}| {DIV(style='text-align: center')}Sample Table{DIV} | |---| | row1-col1 | row1-col2 | | row2-col1 | row2-col2 | {DIV} %clear% ## Help & Hints - 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 ~np~||~/np~ table mode is enabled. ## Related pages ((Wiki-Syntax Links)) ((Wiki-Syntax Lists)) ((Wiki-Syntax Images)) ((Wiki-Syntax Text)) ((Wiki-Syntax Separators)) ((Wiki-Syntax Special Characters)) ((Advanced Wiki Syntax Usage Examples)) ((PluginFancytable))