[Zope-Moz] Templates anyone?

Martijn Pieters mj@digicool.com
Sun, 27 Feb 2000 09:46:41 -0500


From: Shalabh Chaturvedi [mailto:shalabh@pspl.co.in]
> Martijn Pieters wrote:
> >
> > That's exactly what the component tag is so handy for:
> >
> >   <dtml-let resultset="'name_of_sql_method'" show_next_prev="1"
> >             head="'<th>id</th><th>value</th>'">
> >     <dtml-component component="batched_resultstable">
> >       <td>&dtml-id;</td><td>&dtml-value;</td>
> >     </dtml-component>
> >   </dtml-let>
> >
> > Above code would be generated by ZopeStudio.
> 
> I'd also like to see how 'batched_resultstable' is defined. 
> Is this thing
> implemented already? (why don't I know?)

It is something I just made up, but that would work, if/when the
dtml-component tag is included in Zope. 

It just is a callable object, that gets fed a attribute named
component-contents with the dtml code in within the block in it. 

Come to think of it, I am not sure if the above would work. The contents
of the dtml-component tag are likely to have been rendered _before_
insertion, not after. Hmm.. If the code in the component block doesn't
get called until insert it, the following could be he contents of
batched_resultstable (approx, out of my head and all):

  <!-- something displaying the next and previous sizes her
       based on whether or not show_next_prev is true -->
  <dtml-in expr="_[resultset]" size=20>
    <dtml-if sequence-start><table><tr><dtml-var head></tr></dtml-if>
    
    <tr><dtml-var component-contents></tr>

    <dtml-if sequence-end></table></dtml-if>    
   
  </dtml-in>

-- 
Martijn Pieters, Software Engineer 
| Digital Creations http://www.digicool.com 
| Creators of Zope      http://www.zope.org 
| mailto:mj@digicool.com       ICQ: 4532236
| PGP:
http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 
-------------------------------------------