Question

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 ?

Was it helpful?

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!

OTHER TIPS

Your last question: http://zpt.sourceforge.net/

Since the other question isn't that specific, I'm not sure there's a definitive answer to this, unless one of the original developers answers.

Zope Page Templates is the templating system making use of TAL/TALES/METAL, and the specific issue it tries to solve is the same as with many other templating systems: produce valid HTML. In the case of ZPT it is possible to create also any flavour of XML. At the time of its creation, it had some outstanding properties:

  • the templates itself could be used in designing tools like Dr*beep*mw*beep*ver or Fr*beeb*ntp*beep*ge without modification
  • the nested structure of XML/XHTML was ensured (invalid structured XML wouldn't work)
  • the templates themselves could be nested, mixed and matched
  • pure python implementation (rather clean code) and embedded python expressions

in the meantime the web has caught up and there are many alternatives available

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top