Monday, November 19, 2012

TAL, phpTAL, cheatsheets


Primers
http://www.owlfish.com/software/simpleTAL/tal-guide.html
https://weblion.psu.edu/trac/weblion/wiki/TAL

This is also a way to "comment" things out of your code.
<tal:comment tal:replace="nothing">
*********************
Nothing between the opening and closing tal:comment tags will show up in the browser.
You can write what you like in here.
It's a great way of putting documentation into your templates.
Note, we don't have to say "tal:comment". We could say tal:aadvark or tal:teakettle or tal:whateverWeLike.
However, "tal:comment" is a useful convention to indicate to anyone reading the template that this is likely to be...
(gasp) a comment.
*********************
</tal:comment>



http://phptal.org/

PHPTAL is a templating engine for PHP5 that implements brilliant Zope Page Templates syntax:
<div class="item" tal:repeat="item itemsArray">
    <span tal:condition="item/hasDate" tal:replace="item/getDate"/>
    <a href="${item/getUrl}" tal:content="item/getTitle"/>
  <p tal:content="value/getContent"/>
</div>
PHPTAL is fast thanks to compiled templates and fine-grained caching. Makes it easy to generate well-formed XML/XHTML (protected against XSS attacks). PHPTAL's code is mature and improving. Released free under LGPL.
See the introduction.


http://en.wikipedia.org/wiki/Template_Attribute_Language

omit-tag
allows to omit the start and end tag and only render the content if the given expression is true.
on-error
if an error occurs, this attribute works like the content tag.













No comments:

Post a Comment