[EMAIL PROTECTED] wrote: > Could someone that has used all the different ways mentioned above for > dynamic HTML > content, suggest what the pros and cons of the different methods are?
Not used them all - as you say, there's a plethora of options - but to give you a general idea of the territory... First choice you have is between HTML generators vs. HTML templating systems: - HTML generators create all markup from scratch. Useful when producing arbitrary markup/layout whose entire structure must be determined programmatically, e.g. applying paragraph and character styling to a big chunk of text, creating arbitrary HTML form layouts based on other input. Examples: htmlgen (crusty, HTML 3.1-era), Nevow's Stan engine. - HTML templates insert individual items of data into a mostly static block of HTML markup written in advance by e.g. a graphic designer. Useful when creating documents that are fairly regular in structure - most fall into this category - as it's much easier to create the repetitious parts using standard HTML editing tools than write code to produce it all programmatically. Sometimes you might combine the two methods, using an HTML generator to create sections of markup from arbitrary input which is then inserted into a full-page template to produce the finished HTML document. Assuming a templating-based solution is the appropriate choice for you (which it most likely is), there are three general approaches to choose from: 1. Systems that embed markup in code. This is a fairly small category. It's fairly programmer-friendly since you've direct access to all language features, but hostile to web designers as you have to pull your HTML markup apart and insert it into program code to produce the final template, making it a pain to modify that markup later. Examples: ad-hoc solutions using Python's string interpolation, the Quixote framework's built-in templating support, Karrigell (though it supports some aspects of approach 2 as well). 2. Systems that embed code in markup. This is the most common category with a fair amount of variety and capabilities to choose from. Lots of obviously PHP/ASP-inspired designs. Two sub-categories: systems that embed standard Python code, e.g. PSP, and systems that embed a custom language, e.g. Cheetah. Some provide no restrictions on what you can get up to within embedded code, others restrict functionality to enforce a strict separation between presentation logic and model logic. Embedding styles also vary: some mix code statements and markup directly (e.g. Cheetah), some embed code statements in special <%...%> style tags (e.g. PSP), some hide all code within HTML tag attributes (e.g. TAL, Kid), providing varying degrees of designer-friendliness as a result. 3. DOM-style systems. This is a more recent arrival and a smaller category. These systems completely separate markup from presentation logic. Selected HTML elements are flagged using specific named tag attributes (e.g. id="somename") or simple compiler directives, e.g. (nevow:render="somename"); the template is then compiled into a simple templating-oriented (i.e. not w3c) DOM, allowing these elements to be manipulated programmatically by standard Python scripts. Very designer and developer friendly, although less experienced programmers may find the higher level of abstraction involved a bit offputting. Examples: PyMeld, HTMLTemplate [1], Nevow.Render. For a fairly extensive list of available systems, see <http://wiki.python.org/moin/WebProgramming>. Unfortunately they're not well categorised there, but I can't think of a better, up-to-date list off the top of my head and most will provide decent overviews so it shouldn't take too long to take a quick look at each. Note that some templating engines are embedded into larger web programming frameworks and may or may not be usable independently. Conversely, some web frameworks may be coupled to a specific templating system, while others allow you to choose your own. HTH has -- [1] Disclaimer: I wrote HTMLTemplate. Also, shameless plug: <http://freespace.virgin.net/hamish.sanderson/htmltemplate.html> -- http://mail.python.org/mailman/listinfo/python-list