[Zope] ZPT: conditional omitting of a tag
martin f krafft
madduck@madduck.net
Wed, 29 Jan 2003 10:05:43 +0100
--LQksG6bCIzRHxTLp
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
hi there,
let's say i have something like
<a href=3D"#" tal:attributes=3D"href person/homepage">
<span tal:replace=3D"person/name" />
</a>
within a tal:repeat in a ZPT.
is there a way to test for person/homepage first, and if it does not
exist, just omit the <a> tag but publish the <span> tag (effectively
printing the name without a link)?
right now i am doing it like so:
<div tal:condition=3D"person/homepage">
<a href=3D"#" tal:attributes=3D"href person/homepage">
<span tal:replace=3D"person/name" />
</a>
</div>
<div tal:condition=3D"not:person/homepage">
<span tal:replace=3D"person/name" />
</div>
which is ugly at best.
also, is there an 'else' construct in TALES?
--=20
martin; (greetings from the heart of the sun.)
\____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
=20
NOTE: The pgp.net keyservers and their mirrors are broken!
Get my key here: http://people.debian.org/~madduck/gpg/330c4a75.asc
=20
"non sposarti. trova una donna che odi e comprale una casa."
--LQksG6bCIzRHxTLp
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+N5lnIgvIgzMMSnURAuAhAKCHbHfjJhnqI6m3zytDLQlJRx+18ACgunhP
MQYdTDUUKu6vyqV71Y7pGck=
=tJJw
-----END PGP SIGNATURE-----
--LQksG6bCIzRHxTLp--