On Mon, Apr 13, 2009 at 10:51 AM, Vishal <[email protected]> wrote: > To take this question further....It seems it would help everyone if someone > could explain...the need for Templating vs Creating HTML on the fly like we > did in CGI scripts. > Why would there be a need for Templating...if we can create similar HTML on > the fly...by simply using print statements and raw strings that can be > stored in the python file or using modules like HTMLTags.py or HTMLgen.
Your dichotomy is not exactly accurate. People initially using print statements directly print strings. Then they put these strings in files which can be substituted. Then they find that they're cutting/pasting into multiple files so they introduce some facility to include other strings. Then they find that they don't want to change all the content but just some parts so they introduce some substitution tricks. Then they want valid XHTML even if their application tries to mess up so they separate form and content. This goes on and you get a templating language. It's really a gradual change rather than a 'direct HTML' vs. 'templates'. I for one find it very convenient to use a templating system (I mostly use clearsilver). It's easy to modify my layout without touching my actual code. [..] -- ~noufal _______________________________________________ BangPypers mailing list [email protected] http://mail.python.org/mailman/listinfo/bangpypers
