There are four directives for table processing. All must be at the beginning of a line to have any effect.
Generates a new HTML <table> tag with the attributes provided in attr.... Closes the previous table, if any. Valid attributes and values are:
Generates a new cell with the attributes given by attr.... Closes the previous table cell, if any. In HTML, this creates a new "<td attr>" tag (and possibly <table>, <tr>, and </td> tags if they are needed to produce a valid HTML table).
Valid attributes and values are:
Generates a new cell at the beginning of the next row. Closes the previous table cell, if any. In HTML, this creates a "<tr><td attr>" tag, and possibly <table>, </td>, and </tr> tags if they are needed for valid HTML. Valid attributes and values are:
Closes the previous table cell and closes off any table. Generates </td>, </tr>, and </table> tags as needed.
If not already set, PMWiki will automatically include the attribute valign='top' with all
(:cellnr:). PM said "Table Directives were created for layout purposes and in that case it makes the most sense for each cell (column) to have its content at the top of the row. The attribute is placed in each cell and not in the row because certain browsers didn't recognize valign='top' in the row tag.
For the table, cell, and cellnr tags the author can specify any attributes that would be valid in the HTML <table> or <td> tags. Thus you can specify rowspan, colspan, etc. arguments to build arbitrary tables. However, it's not possible to nest a
(:table:) inside of a
(:cellnr:) -- the next paragraph explains why.
Many are likely to ask why we didn't just use the standard HTML table markup (<table>, <tr>, <td>, <th>) instead of creating a new markup, and allowing nested tables as a result. There are two answers: first, the HTML table markup is very ugly for naive authors (see PmWiki.Audiences and PmWikiPhilosophy #2), and second, it'd be very easy for authors to create tables that are incorrect HTML and that display incorrectly (or not at all) on some browsers. Even seasoned web professionals sometimes get the table markup wrong, so it's a bit unrealistic to expect the average author to always get it right, or to be able to read arbitrary HTML table markup that someone else has created.
It's difficult to write the code needed to make PmWiki understand and fix arbitrary table markup, so PmWiki uses the simplified version above. Still, this version is able to handle most table requirements (with the possible exception of nested tables).
And, this is not to say that nested HTML tables are impossible in PmWiki --they just can't be easily created by wiki authors using the default wiki markup. A site administrator can of course create header/footer HTML code and other local customizations? that make use of nested tables.
" is a non-breaking space in html. Place it in a cell if a cell is to be empty or the border of the cell will not be drawn properly.
In HTML, this is the same as
<table border='1' cellpadding='5' cellspacing='0'> <tr> <td>a1</td> <td>b1</td> <td>c1</td> <td>d1</td> </tr> <tr> <td>a2</td> <td>b2</td> <td>c2</td> <td> </td> </tr> </table>
What if you wanted to create a nice little table like a table of contents in a page like this? In this example, the table is floating right and contains some links in a bulleted list. This is a nice demonstration of how it's possible to build a little table of contents in the page, which might navigate to other pages just within the same wiki group. Note that having a bulleted list won't work in a ordinary table - it only works inside an table created with table directives such as the example code used here.
Looking at the markup here, notice that we have used a #cccc99 hex color for the table background. Also, the
(:cellnr:) markup creates a new row, a new cell and closes the row at the end.
You could take this concept a little further: since you might want each page in the group to contain the same table of contents, you can make ONE table like the above and put it in its own page. Then use an include ? on any of your pages and bring in the table. The float (align) property will be honored in each page where it's included. Pretty sweet!
Can I define table headers using the table directive markup?
Is it possible to do nested tables?
Yes, if you nest simple tables inside advanced tables. See also Cookbook:AdvancedTableDirectives.
Is it possible to add background images to tables and table cells?
Yes, see Cookbook:BackgroundImages.
Is it possible to have a collapsible table, that you can set by default to be deployed (as with the (:toc:) display) or retracted?
Tutoriais de Tecnologia Web