[Zope] dtml-always et al
Andrew Kenneth Milton
akm@mail.theinternet.com.au
Sat, 24 Jun 2000 13:03:44 +1000 (EST)
+----[ Lalo Martins ]---------------------------------------------
| 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 sometimes you just need to rethink what "clean" is... and
where you want clean, and where you're willing to be a little dirty.
<dtml-call "REQUEST.set('link_url','')">
<dtml-call "REQUEST.set('link_end','(no link currently available)')">
<dtml-if X>
<dtml-call "REQUEST.set('link_url','<ahref=a_url>')">
<dtml-call "REQUEST.set('link_url','</a>')">
</dtml-if>
<dtml-var link_url>link text<dtml-var link_end>
I would do it this way, if I could pre-set that text in an earlier
<dtml-call> and the programming logic, would mess up my display flow,
it works nicely for <dtml-in> where you have a list of URL's, and you
can hide the ugliness in another place.
<dtml-in 'url-list'>
<dtml-call "setLinkText(REQUEST)">
<dtml-var link_url>link text<dtml-var link_end>
</dtml-in 'url-list'>
--
Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton
The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 |
ACN: 082 081 472 | M:+61 416 022 411 | Carpe Daemon
PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|