[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Advanced Page Templates

webmaster@zope.org webmaster@zope.org
Wed, 25 Sep 2002 18:29:48 -0400


A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/AdvZPT.stx#3-11

---------------

      You can define your own variable using the 'tal:define'
      attribute. There are several reasons that you might want to do
      this. One reason is to avoid having to write long expressions
      repeatedly in a template. Another is to avoid having to call
      expensive methods repeatedly. You can define a variable once and
      then use it many times in a template. For example, here's a list
      that defines a variable and later tests it and repeats over it::

        <ul tal:define="items container/objectIds"
            tal:condition="items">
          <li tal:repeat="item items">
            <p tal:content="item">id</p>
          </li>
        </ul>

        % Anonymous User - Apr. 29, 2002 1:35 pm:
         "You can define a variable once and then use it many times in a template. "
         shouldn't this be ...
         "You can define a variable once and then use it many times within its defining tag. " or omit since it is
         clarified later.

        % Anonymous User - Sep. 25, 2002 6:29 pm:
         What abt defining more than one variable? (section heading is plural!) blf