[Zope] how detect a variable from template father?

Andreas Jung lists at zopyx.com
Wed Jun 24 18:19:20 EDT 2009


On Thu, Jun 25, 2009 at 00:17, Miguel Beltran R. <yourpadre at gmail.com>wrote:

> Hi list
>
> I have 2 templates, in second template I need render a <span> only when the
> first template have defined a variable.
>
> template1:
> <ul tal:define="var1 python:1">
>    <li tal:replace="structure conext/template2"></li>
>    <li tal:replace="structure python:conext.template2(var2=1)"></li>
> </ul>
>
> template2:
> <li>
>    <input id="x" name="x" value="somevalue">
>    <span tal:condition="exists: var1">span2</span>
>    <span tal:condition="exists: attr/var1">span2</span>
>    <span tal:condition="exists: context/var1">span2</span>
>    <span tal:condition="exists: container/var1">span2</span>
>    <span tal:condition="exists: options/var2">span3</span>
> </li>
>
> any condition in span not work :(
>

The 'options' namespace is your friend.

-aj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20090625/35b5f633/attachment.html 


More information about the Zope mailing list