[Zope] Using MySQL results for condition checking in ZPT
Fernando Martins
fmartins@hetnet.nl
Sun, 23 Feb 2003 13:25:17 +0100
Ben M. Thomas wrote:
[...]
> My TAL condition that I'm attempting to use is something like:
>
> For the Table Header:
> <span tal:condition="result/Category">
> <th>Category</th>
> </span>
>
> And the Body:
> <span tal:condition="result/Category">
> <td><span tal:replace="result/Category">Category goes here</span></td>
> </span>
>
If I understand correctly, you're getting an error when Category is not an
attribute of result.
I think you are looking for:
<th tal:condition="exists:result/Category">Category</th>
and
<td tal:condition="exists:result/Category"
tal:content="result/Category">Category goes here</td>
(no need for span tags)
Look for "Alternate Paths" and "Exists Expressions" in chp. 9 of the Zope
Book
HTH,
Fernando