[Zope] dtml-always et al

Lalo Martins lalo@hackandroll.org
Fri, 23 Jun 2000 17:55:39 -0300


On Fri, Jun 23, 2000 at 12:49:16PM +0530, Shalabh Chaturvedi wrote:
> Hi:
> 
> Could you give an equivalent using the current dtml tags?
 
> From: Jay, Dylan <djay@lucent.com>
> 
> > <dtml-if X>
> >  <a href="a_url">
> > <dtml-always>
> >  link text
> > <dtml-else>
> >  (no link currently available)
> > <dtml-then>
> >  </a>
> > </dtml-if>

If I understood it correctly:

<dtml-if X>
 <a href="a_url">
</dtml-if>
 link text
<dtml-if X>
 </a>
<dtml-else>
 (no link currently available)
</dtml-if>


Or alternatively:

<dtml-if X>
 <a href="a_url">link text</a>
<dtml-else>
 link text (no link currently available)
</dtml-if>


Or using Jay's proposal:

<dtml-if X>
 <a href="a_url">
 <dtml-always>
  link text
 </dtml-always>
 </a>
<dtml-else>
 (no link currently available)
</dtml-if>

I don't really think this is an improvement.


As for <dtml-then>, of course it should be </dtml-else>
instead. It's hard to see the point here, and there is no point
at all if there isn't a dtml-always (except for XML
nitpickness); but with dtml-always there _may_ be a point.

<dtml-if X>
 foo
 <dtml-always>bar</dtml-always>
 zoo
 <dtml-else>
  goo
  <dtml-always>mar</dtml-always>
  moo
 </dtml-else>
 woo
  <dtml-always>far</dtml-always>
 boo
</dtml-if>

This will render either:

when X is true:
 foo bar zoo mar woo far boo
when X is false:
 bar goo mar moo far

So suddenly order starts mattering.

It's a rather convoluted way of achieving this results, but
there may be situations where this is useful. I don't know.

[]s,
                                               |alo
                                               +----
--
          Hack and Roll  ( http://www.hackandroll.org )
            News for, uh, whatever it is that we are.


http://zope.gf.com.br/lalo           mailto:lalo@hackandroll.org
         pgp key: http://zope.gf.com.br/lalo/pessoal/pgp

Brazil of Darkness (RPG)    ---     http://zope.gf.com.br/BroDar