SV: [Zope] ZPT: ready for prime time?

Magnus Heino (Rivermen) magnus.heino@rivermen.se
Mon, 25 Jun 2001 11:10:14 +0200


> > <table border="0"
> >         tal:define="activeTab python:request.get('activeTab', 0)">
> > <tr tal:repeat="tab tabList">
> > <td align="center" width=97 height=19 background="frontTab.gif"
> >      tal:define="index repeat/tab/index"
> >      tal:attributes="background python:test(index==activeTab,
> >        'frontTab.gif', 'backTab.gif')">
> >    <a href="/" tal:attributes="href tab/target"
> >                tal:content="tab/label">Label</a></td>
> > </tr>
> > </table>
> 
> You're joking right? They're both horrible :-(
> 
> I'm sure the second one could be made nicer with a bit mroe 
> PythonScript usage,
> if not then I'll stick with DTML, and I'm sure people here 
> can remember how much
> I like DTML ;-)

Well, if you don't need the template to look good in Dreamweaver or
something, you can get it down to something like this;

<table boder="0">
  <tr tal:repeat="tab tabList">
    <td align="center" tal:attributes="background
python:test(repeat.tab.index == here.REQUEST.activeTab,
                                      'frontTab.gif', 'backTab.gif')">
      <a tal:attributes="href tab/target" tal:content="tab/label" /></td>
  </tr>
</table>

I am waiting for the day when ZPT is default and DTML only is in Zope for
compatibility with older versions... I for sure will never use DTML again.

/Magnus