Mike Orr <[EMAIL PROTECTED]> wrote:
> On Wed, Jun 06, 2001 at 04:44:41PM -0500, Ian Bicking wrote:
> > DTML-style tags produce wildly improper HTML, not to mention XML
> > (e.g., <img src="<dtml-var imagename>">).  
> 
> DTML has an entity syntax to get around that:
> 
> <img src="&dtml-imagename;">

Yeah, but it won't always work, even if you are clever.  Like if you
want to highlight the background of rows that match some condition.

  <tr bgcolor="<dtml-if c>#ffdddd<dtml-else>#ffffff</dtml-if>">

Because you can't take the dtml-if out of the entire row, since:

  <dtml-if c><tr bgcolor="#ffdddd"><dtml-else>
  <tr bgcolor="#ffffff"></dtml-if>

is kind of messed up too.

You could do something like

  <dtml-let bgcolor="<dtml-if c>#ffdddd<dtml-else>#ffffff</dtml-if>">
  <tr bgcolor="&dtml-bgcolor;">
   ...
  </dtml-let>

But that's still messed up, because DTML isn't well suited to
nesting.  But at least only the DTML portions of the code are messed
up, the HTML is more or less intact.

If DTML had assignment, instead of just dtml-let, then you could
actually fix this:

  <dtml-if c>
    <dtml-set bgcolor="#ffdddd">
  <dtml-else>
    <dtml-set bgcolor="#ffffff">
  </dtml-if>

I'm not sure why DTML doesn't have this -- if DTML used static
scoping, I could understand why dtml-let adds a certain elegance.  But
they threw that all out with the dynamic scoping, so why bother?

Anyway, that's my rant on one of the evils of DTML.  I suppose some of
the problems could be fixed with a better syntax that was still
XML-like.  Wasn't DTML going to go to XML at some point?  They'd have
to fix these in that case, but maybe ZPT has made the flaws of DTML
moot.

Though I'm not entirely sure how you would do this in ZPT either --
tal:condition and tal:attributes don't really nest, so how do you
conditionally change an attribute?  If you have an if function (like
def iff(c, t, f):
  if c: return t
  else: return f
), that'll work.  But that doesn't feel like it really fits in TAL/ZPT
very well.

  Ian

_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to