Eric Walstad
eric at ericwalstad.com
Mon Aug 16 18:29:29 EDT 2004
Hey Miles, On Monday 16 August 2004 04:51 pm, Miles K. Forrest wrote: [snip] > But I _want_ to learn. And I'd like to seperate the HTML and > Python code so I can still rely on HTML designers who, unlike > myself, know how to build nice looking pages. And I'd like to use > Python. But I can't seem to get a platform working. Sorry if you mentioned this in other posts, but do you have mod_python working using the tutorial and examples yet? If not, I'd get those nailed down before you start experimenting with templating. Templating will be one more layer of stuff to have to debug and could result in more hair-pulling-late-night-frustrations. > I suppose having lots of choices when it comes to templating if you > know what you're doing, but for someone like me the choice is > difficult: which _should_ I choose? Being told "it depends on what > you're doing" doesn't help because I'm not sure what I'm going to > do, I'm still learning. I'm leaning towards PSP because it's > built-in to mod_python, so it seems to me it will become a standard > way of templating because it's already there. > > Can any gurus out there help guide this neophyte? (wincing a bit as > I click send in fear of a "RTFM" retaliation - I've read so much my > eyeballs are beginning to glaze over) Here's *this* neophyte's templating system of choice: SimpleTAL <http://www.owlfish.com/software/simpleTAL/> """ SimpleTAL is a stand alone Python implementation of the TAL, TALES and METAL specifications used in Zope to power HTML and XML templates. SimpleTAL is an independent implementation of TAL; there are no dependencies on Zope nor is any of the Zope work re-used. """ I like SimpleTAL because I already have experience with Zope's TAL/METAL templating system so there was no syntax for me to learn. Also, TAL plays VERY nicely with Dreamweaver, etc, as the syntax is XML. Also, there's lots of documentation and examples for using Zope's Page Templates available out there. (consider the terms ZPT, Zope Page Templates, TAL/METAL and SimpleTAL basically synonymous) Here's a quote from Zope's TAL documentation that might give you an idea of how they work: <http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ZPT.stx> """ How Page Templates Work Page Templates use the Template Attribute Language (TAL). TAL consists of special tag attributes. For example, a dynamic page title might look like this: <title tal:content="here/title">Page Title</title> The tal:content attribute is a TAL statement. Since it has an XML namespace (the tal: part) most editing tools will not complain that they don't understand it, and will not remove it. It will not change the structure or appearance of the template when loaded into a WYSIWYG editor or a web browser. The name content indicates that it will set the text contained by the title tag, and the value "here/title" is an expression providing the text to insert into the tag. """ In other words, the "Page Title" part above is replaced with the value of the variable named "title". Of course, there are tags for looping, conditionals, etc. I hope that helps. Eric.
|