[ZPT] ZPT and plain-text or CSS
Thu, 17 Jan 2002 18:06:30 -0000
I'm just learning ZPT (using it with CMF), and I think I'm trying to be far
too clever for my own good! :-)
http://lists.zope.org/pipermail/zope-dev/2001-December/014405.html - this
thread suggests it's possible to use ZPT in plain-text or CSS files, but I'm
having trouble getting it to work!
I'm trying to setup a CSS stylesheet that can be edited either TTW (via a
form that edits the PT's properties), or directly by Dreamweaver or similar
(via WebDAV/FTP) - depending on a boolean property "ttw_style_editing" of
the portal folder.
To test this I created a PT "stylesheet.css" in the portal root. And a
PythonScript "ttw_style_editing", into which I type either "return 1" or
"return None" for testing purposes.
In stylesheet.css I put the following -
background-color: <x tal:replace="template/bgcolor_setting"
- where "bgcolor_setting" is a string-property of the PT, containing
It kinda works :-)
When I test it with ttw_style_editing returning 1, I get exactly what I
wanted - the value of the template/property. But my problems are -
1. When I Browse HTML source, all the tal tags are still there. Is there any
way to hide them so people pulling the .css with WebDAV/FTP won't see them?
I tried the Omit-tag, but it doesn't seem to affect source?
2. If ttw_style_editing returns None, I get a blank space instead of
#FFFFFF, is my "|default" syntax wrong?
3. If I change the Content-Type from text/html to text/css or text/plain I
get an error -
xml.parsers.expat.ExpatError: syntax error: line 1, column 0
I'm using CMF 1.2 and Zope 2.5b3 on Win 2000.
Hope that all makes sense? Am I attempting the impossible?