[Typo3-dev] Zope TAL as a concept for Typo3 Templates

Michael Scharkow mscharkow at gmx.net
Wed Jul 20 21:06:48 CEST 2005


Sven Wilhelm wrote:
> Hi,
> 
> after researching functionality of zope I also learned about the
> template systems of zope. Learning more about Template Attribute
> Language made me smile when thinking for the chances of improving the
> typo3 template system.

Hi Sven,

did you take a closer look at ZOPE? I'm still looking for someone to
exchange experiences with TYPO3 and ZOPE/Plone...

> tal does many things like also done today in typo3, substitution of
> markers, the ony difference is, that they provide a xml-namespace for
> tal and so it could be used by designers too in a gui environment and it
> validates.

This is just the simplest possible application of tal, using
replace/content. But apart from being XML (which is not really an
advantage to me, as you can validate TYPO3's html-Templates with markers
and subparts as well, and you can also validate TS), they move the
representational logic into the template, whereas in TYPO3 you do this
in TS or extension PHP code. I have not thought too much about this, but
I think I prefer having this in the code and not in the template, as it
has no value to the designer to have things like this in your template.

<table tal:condition="container/objectValues"
       border="1" width="100%">
  <tr>
    <th>Number</th>
    <th>Id</th>
    <th>Meta-Type</th>
    <th>Title</th>
  </tr>
  <tr tal:repeat="item container/objectValues">
    <td tal:content="repeat/item/number">#</td>
    <td tal:content="item/getId">Id</td>
    <td tal:content="item/meta_type">Meta-Type</td>
    <td tal:content="item/title">Title</td>
  </tr>
</table>

For a programmer, it is quite natural to implement the loop in code

foreach ($container as $item){
$out .= substitutemarkerarray($item['type'), $item['props']);
}

TAL is really suited for the rigid OO-aproach ZOPE takes, but until
TYPO3 offers access to TCA-tables' attributes like that, it doesn't get
us very far.

> using tal could be a way to not include so much template stuff like
> already stored with templavoila in the database.

Given the verbosity of TAL, I don't expect this to save much space. It
might reduce the TS involved, but tempplate files will grow at least as
much. Plus I still find TS easier to grok for a human but this is
personal taste...

Greetings,
Michael




More information about the TYPO3-dev mailing list