[ZPT] Re: Problems with context and rendering and DTML and... a story of failure and puzzlement

steve steve@spvi.com
Thu, 21 Jun 2001 15:36:29 -0500


Two more 'quickies' ;-)

1)

I'm having trouble converting this DTML method to ZPT. 'tabList' is a TinyTable.

<dtml-call "REQUEST.set('activeTab',REQUEST.get('activeTab',0))">
<table border="0">
<tr>
<dtml-in tabList>
<dtml-if "_['sequence-index']==activeTab">
<td align="center" width=97 height=19 background="frontTab.gif"><a href="&dtml-target;">&dtml-label;</a></td>
<dtml-else>
<td align="center" width=97 height=19 background="backTab.gif"><a href="&dtml-target;">&dtml-label;</a></td>
</dtml-if>
</dtml-in>
</tr>
</table>

Specifically.. is there anything like 'sequence-index' in ZPT? How about
sequence-start and sequence-end (even though they are not used in this
example. It's too bad zpt-archive is not *easily* searchable. 

2) 

I never heard back about this part of my  original query (below).. any
ideas about this are most welcome.

thanks,
-steve

steve wrote:
> 
> I finally resorted to making a ZPT object, called
> 'ptBiopsyTypesControl.html' with a macro to do this::
> 
> <html>
>   <head>
>     <title tal:content="template/title">The title</title>
>   </head>
>   <body>
>   <form>
>    <div metal:define-macro="biopsyTypesSelect">
>            <select name="biopsyType">
>                    <option value="dummyValue"
>                    tal:repeat="aType container/biopsyTypes"
>                    tal:attributes="value aType/name"
>                    tal:content="aType/name">A Dummy Option</option>
>                 </select>
>    </div>
>   </form>
>   </body>
> </html>
> 
> I tested it 'stand-alone' and it worked. Cool.
> 
> Now I try to invoke it from my template (in the folder above):
> 
> <span metal:use-macro="here/Structures/ptBiopsyTypesControl.html/macros/biopsyTypesSelect"/>
> 
> Ack.. the biopsyTypesSelect can't find the biopsyTypes TinyTable again!
> What does 'container' mean? I expected it meant the container of the
> template that defined the macro. Anyway... I decided that
> 'here/Structures/biopsyTypes should work in both places, so I changed it to:
> 
> tal:repeat="aType here/Structures/biopsyTypes"
> 
> and all was well. *But* I don't really love the notion that my control
> macro needs to know the how it's going to be called so that it can find
> it's stuff then. Am I missing something that should be obvious? (probably!)
> 
> thanks,
> -steve