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

webmaster@zope.org webmaster@zope.org
Wed, 25 Sep 2002 20:40:45 -0400


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

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

      If you want to override the ordering of TAL statements, you must
      do so by enclosing the element in another element, possibly
      'div' or 'span', and placing some of the statements on this new
      element. For example suppose you want to loop over a series of
      items but skip some. Here's an attempt to write a template that
      loops over the numbers zero to nine and skips three::

        <!-- broken template -->
        <ul>
          <li tal:repeat="n python:range(10)"
              tal:condition="python:n != 3"
              tal:content="n"> 
            1
          </li>
        </ul>

        % gotcha - Apr. 22, 2002 4:22 am:
         >       If you want to override this ordering, you must do so by enclosing
          >       the element in another element, possibly div or span, and placing
          >       some of the statements on this new element.

         This sentence could be removed and replaced by something like:

         tal: prefixed elements are allowed and interpreted. Further, any tal: prefixed element has a default
         tal:omit-tag like behaviour.
         If you want to override this ordering, you can use tal: prefixed elements.

         Example::
         <tal:formfields repeat="field python:form.get_fields()">
           <tal:fieldid define="fieldId python:field.getId()">
              <tal:m_formaterrorbyfield
              metal:use-macro="here/PT_macros/macros/formatErrorByField"
              condition="python:errorMap.has_key(fieldId)">
                  <p class="errorMessage"
                     tal:content="python:errorMap[fieldId].error_text"></p>
              </tal:m_formaterrorbyfield>
           </tal:fieldid>
         </tal:formfields>

        % Anonymous User - Apr. 29, 2002 4:06 pm:
         This new example took the polar route as it both introduces a new concept without explaining it well and does
         not solve the problem identified in the example above.
         were you instead suggesting:
         <ul>
           <tal:loop repeat="n python:range(10)">
              <li tal:condition="python:n != 3" tal:content="n">1</li>
           </tal:loop>
         </ul>

        % Anonymous User - Aug. 8, 2002 7:59 pm:
         First sentence:
         ...statement can be used on a single tag. Since HTML does not...
         should be 
         ...statement can be used on a single tag, since HTML does not...

        % Anonymous User - Sep. 25, 2002 8:40 pm:
         /and placing/and place/