# Writing Templates Chameleon templates are HTML files that happen to be alive. Open one in a browser and it renders as a static mockup. Hand it to the engine with some data and the same file becomes the page. That trick is possible because Chameleon's logic lives in attributes on ordinary elements, not in tags of its own. If you have used Zope Page Templates or Pyramid, this is the TAL and METAL you already know. If you are arriving from Jinja or Django, the first thing to unlearn is `{% %}` and `{ }`. Chameleon has neither. Interpolation is `${expr}`, and loops and conditions are `tal:` attributes. After about an hour the syntax stops feeling foreign and starts feeling like your HTML got a promotion. # Interpolation and expressions Anything inside `${ }` is a Python expression, evaluated against the dict your view returned: ``` html

Hello, ${user.name.title()}!

You have ${len(items)} item(s).

``` Real Python, not a template dialect. Method calls, slicing, conditional expressions, `len()`, all of it. Output is HTML-escaped by default, so a book title containing `