[Zope] Repetetive ZPT

martin f krafft madduck@madduck.net
Sat, 1 Feb 2003 21:03:48 +0100


--2fHTh5uZTiUOsy+g
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

I have the following bit of TALES code in one of my pages. It doesn't
occur just once, it occurs multiple times, with the parameters at
AAAAAA, BBBBBBB, CCCCCCC, and DDDDDDD changing between each
occurrence:

        <tr tal:define=3D"field form/AAAAAA;
               value request/form/field_BBBBBB|person/CCCCCCCCC|nothing">
          <td class=3D"label" tal:content=3D"field/title">Label</td>
          <td class=3D"field">
            <input type=3D"text"
              tal:replace=3D"structure python:field.render(value)" />
            <span class=3D"formerror" tal:on-error=3D"string:"
                tal:condition=3D"showerrors"
                tal:content=3D"structure python:formErrors['DDDDDD']">
              Error
            </span>
          </td>
        </tr>

Because everything else is the same, I'd like to factor the code out.
I was thinking about macros, but using macros within tal statements or
tags produces compilation errors.

How else can I factor the above out and parametrise it?

Thanks,

--=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
a friend is someone with whom
you can dare to be yourself

--2fHTh5uZTiUOsy+g
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+PCgkIgvIgzMMSnURAvFXAKDcUufP+NaUKchGHhXP3CM+brGSXQCeK69F
41xd7/cXcV9uh8tO/htryPs=
=8NM1
-----END PGP SIGNATURE-----

--2fHTh5uZTiUOsy+g--