[ZPT] How do I...
Tony McDonald
tony.mcdonald@ncl.ac.uk
Thu, 17 May 2001 14:31:17 +0100
On 17/5/01 2:25 pm, "Evan Simpson" <evan@digicool.com> wrote:
> From: "Tony McDonald" <tony.mcdonald@ncl.ac.uk>
>> 1) I want to use the 'odd' path component to switch the background colour
> of
>> a table row.
>
> In addition to Richard's excellent suggestion, you could do this:
>
> <tr tal:define="odd repeat/item/odd" tal:attributes="bgcolor
> python:test(odd, 'red', 'blue')"
>
Ah, that's very cool!
>> 2) I'd also like to call the above PageTemplate from DTML, substituting
> the
>> module_code='bgm' above with module_code=modcode, and pass modcode into
> the
>> PageTemplate.
>
> As you've discovered, PageTemplates don't have the same sort of call
> signature as Methods. All keyword arguments are available through the
> 'options' variable mapping. You can fall back to a request variable like
> this:
>
> tal:define="opt (if exists) request/module_code;opt (if exists)
> options/module_code"
>
Ah, thanks again (things becoming clearer now!)
> In the next release, if the current proposals continue to meet with
> everyone's approval, you will be able to write:
>
> tal:define="opt options/module_code | request/module_code | nothing"
>
> ...and get the argument if it is defined, else the request value if it is
> defined, else nothing (None).
>
Can't wait!
Many thanks Evan and Richard, I've learnt a lot about ZPT today!
now I need to get back to this **!$*!$ database that I ate in a moment of
madness :(
Thanks again,
Tone.
--
Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/
The Medical School, Newcastle University Tel: +44 191 243 6140
A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope