[ZPT] Lots of HTML in a frame - ZPT or Python script?

Geir Bækholt Geir Bækholt
Wed, 12 Mar 2003 14:23:41 +0100


David Mitchell wrote

DM> I'm at a point in my project where I have to code up the following, which will 
DM> be presented as a single frame of a page:

DM> if variable == 'A':
DM>     render about 500 bytes of HTML
DM> elsif variable == 'B':
DM>     render a different 500 bytes of HTML
DM> elsif variable == 'C':
DM>     ...

what about letting each of the html-chunks be a separate page
template, maintained by your html-monkey, and have a single
python-script return one of them depending on the variable ?

if variable == 'A':
   return context.templateA()
elif variable == 'B':
   return context.templateB()
etc...

or even cleaner:
have a folder "monkeyChunks" with all the templates (named A,B,C
etc..same as the values for 'variable' ) :
then do :

return getattr(context.monkeyChunks, variable)()

:)

--
Geir Bækholt