[ZPT] Nesting a Tag in CSS

Richard Jones rjones@ekit-inc.com
Thu, 10 Oct 2002 09:10:28 +1000


On Thu, 10 Oct 2002 12:47 am, Chris Withers wrote:
> Jeffrey P Shell wrote:
> > Actually,  DTML is fairly well suited to plain text situations.  ZPT
> > intends ONLY to be an XML/HTML based language.  But DTML is still decent
> > for things like SQL Methods and dynamic CSS generation.
>
> DTML has a lot of really bad stuff which could be fixed (lack of paths,
> inconsistent namespaces, the whole name="something" expr="something"
> something "something" debacle) but still doesn't solve the problem of
> needing to know so many languages just to use Zope.
>
> it really should be, at most, 1 scripting language and 1 templating
> language....

The other thing to remember about stylesheets is that they're cascadable. I 
guess you should really look at exactly how many variables there are in your 
sheet, and thus how much of it could be extracted out so that there's a 
common "base" sheet, and then have overrides in a much smaller <style> or 
<link> tag. If it's just colouring, then a TAL-ed <style> tag of the form:

<link rel="stylesheet" href="base.css" type="text/css">
<style type="text/css" tal:content="string:
p { color: ${request/bodycolor} }
.error { color: ${request/errorcolor} }
"></style>

is actually quite reasonable. More readable than DTML IMHO :)


    Richard