[Typo3] TemplaVoila: Creating a template for tables

Dmitry Dulepov typo3 at fm-world.ru
Wed Nov 2 10:03:17 CET 2005


Hi!

David Rosenkranz wrote:
> Hi,
> 
> In "FTB" I read about how to deal with repeatable data objects. I thought
> that this aproach would be good to create a table template thinking of the
> rows as repeatable data objects. So I created this simple HTML:
> 
> ...
> <div id="root">
>  <table id="containertable">
>   <tr id="headline">
>    <td id="headcell1">Col1</td>
>    <td id="headcell2">Col2</td>
>   </tr>
>   <tr id="dataline">
>    <td id="datacell1">Col1</td>
>    <td id="datacell2">Col2</td>
>   </tr>
>  </table>
> </div>
> ...
> 
> Then I created the following DS/TO:
> Root Element (Container, mapped to div#root, inner)
>   Table (Section, mapped to table#containertable, inner)
>     Headline (Container, mapped to tr#headline, inner)
>       Headline cell 1 (Element, mapped to td#headcell1, inner)
>       Headline cell 2 (Element, mapped to td#headcell2, inner)
>     Dataline (Container, mapped to tr#dataine, inner)
>       Dataline cell 1 (Element, mapped to td#datacell1, inner)
>       Dataline cell 2 (Element, mapped to td#datacell2, inner)
> 
> Creating a content element for a page works fine with this new template.
> BUT: rendering produces the following HTML:
> <div id="root">
>  <table id="containertable">
>   <td id="headcell1">COLUMN1</td>
>   <td id="headcell2">COLUMN2</td>
>   <td id="datacell1">DATA2</td>
>   <td id="datacell2">DATA1</td>
>   <td id="datacell1">DATA4</td>
>   <td id="datacell2">DATA3</td>
>  </table>
> </div>
> 
> As you can see, the <tr> tags are missing. How do I have to change my ds/to
> to get this right? Thanks a lot for your support.


Root Element (Container, mapped to div#root, inner)
  Table (Container, mapped to table#containertable, inner)
    Headline (Container, mapped to tr#headline, inner)
      Headline cell 1 (Element, mapped to td#headcell1, inner)
      Headline cell 2 (Element, mapped to td#headcell2, inner)
    Dataline (Section, mapped to tr#dataine, inner)
      Dataline section (Container, mapped to tr#dataline, outer)
        Dataline cell 1 (Element, mapped to td#datacell1, inner)
        Dataline cell 2 (Element, mapped to td#datacell2, inner)

Table itself is not repeatable, so it is not a section. Headline is a
single object, si it is just a container (you could get rid of it too
but it is just convinient to have it). Data line is repeatable so it
must have a section and a container in it. Notice also the order of
inner/outer mappings, this is important.

Dmitry.



More information about the TYPO3-english mailing list