pythonzopetemplate-talzpttemplate-metal

What specific issue try zope folks to solve with TAL, TALES & METAL


TAL, TALES and METAL are all three the zope templating language. The thing that I don't understand is why so much troubles. I don't understand the spirit of ZTL, any tips ?

one more question : is there a standalone library that try to achieve the same thing that ZTL but outside the Zope ecosystem ?


Solution

  • The core idea of tal/tales is to have proper valid (x)html. All the template functionality is in attributes or namespaced elements. HTML editors should work just fine with these templates. Let's give an example. First tal/tales:

    <ul>
      <li tal:repeat="customer customers">
        <a href=""
           tal:attributes="href customer.url"
           tal:content="customer.name>
          Sample customer name
        </a>
      </li>
    </ul>
    

    And in Django's template language, just as an example:

    <ul>
    {% for customer in customers %}
      <li>
        <a href="{{ customer.url }}">
          {{ customer.name }}
        </a>
      </li>
    {% endfor %}
    </ul>
    

    Which one's better? Open question. One plays nice with your html editor, the other makes the non-html statements clearer. Anyway, making it proper html is the main idea behind tal/tales!