[Zope] Page Template tal:replace advice

Norman Khine khine@o-a-l.net
Mon, 14 Jul 2003 19:35:00 +0100


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,
I am trying to generate some static pages from a database, I have
created my template file, but I am have a small problem!

The database has a field image, this contains the image filename, but
some records don't have images at all, so my question is how to
design my template so that if there is an image file, to display it,
if not then not to display any image. Is this possible?

This way we won't get any broken pages that don't show an image.

So if I have this template, how can I include the <img
tal:replace="structure images/35.gif | nothing"/>

<html>
  <head>
    <title tal:content="template/title">The title</title>
  </head>
  <body>
<img src="35.gif" border="0"
     tal:define="im container/35.gif"
     tal:attributes="src    im/absolute_url;
                     width  im/width;
                     height im/height;
                     alt    im/title" />

</body>
</html>


Thanks

Norman




zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
zz/********/z/****\zzz|****\*\zz|*******|z
z/^^^^^^^^/z/******\zz|*^^^^|*|z|*|^^^^^|z norman khine
zzzzzz/**/z|**/^^\**|z|*|zzz|*|z|*|zzzzzzz mailto:norman@khine.net
zzzzz/**/zz|*|zzzz|*|z|****/*/zz|*****|zzz purley
z/******/zz|*|zzzz|*|z|*|^^zzzzz|*|^^^|zzz UK
zzZ/**/zzzz|**\^^/**|z|*|zzzzzzz|*|zzzzzzz
zz/******/zz\******/zz|*|zzzzzzz|*|*****|z
z/^^^^^^/zzzz\^^^^/zzz|^|zzzzzzz|^^^^^^^|z
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

-----BEGIN PGP SIGNATURE-----
Version: PGP 7.0.4

iQA/AwUBPxL303GyKIoODyswEQKJvQCcDgoalAFFd8JQpEg7ZbCCssDEehkAn33f
DMtM+LYHhoj36l36dWGThbjF
=Xq79
-----END PGP SIGNATURE-----