[ZPT] redirection in a zpt

Philip Kilner phil at xfr.co.uk
Fri Jul 8 09:09:47 EDT 2005


Hi,

Kenneth Gonsalves wrote:
> in a zpt, i use tal:condition to check something. If it is true, the 
> browser should redirect to another template. How do it do this? In 
> python cgi i was doing:
> 
> print "Location:" "url_to_go_to/n/n"
> 
> any clues?
> 

- Define each template (for your set of conditions) as a macro.

- In your page, use tal:condition to call the appropriate macro for the
conditions.

You'll find tal:condition-ally calling macros easier to follow than a
redirect. If you must use a redirect, I'd implement the redirect in a
script and conditionally call the templates form the script...


-- 

Regards,

PhilK

Email: phil at xfr.co.uk
PGP Public key: http://www.xfr.co.uk
Voicemail & Facsimile: 07092 070518

"You'll find that one part's sweet and one part's tart:
say where the sweetness and the sourness start."
- Tony Harrison


More information about the ZPT mailing list