Basics
- tal:content="" -> überschreibt text zwischen Tag
- tal:replace="" -> überschreibt den gesamten Tag und nicht nur den Text zwischent Text (vs. content) -> replace="nothing" -> es wird durch "" ersetzt
- tal:attributes="ATTRIBUT WERT"; -> ändert das Attribut eines HTML Tags
- tal:condition="template/title" -> überprüft auf true/false -> falls false -> Tag wird entfernt
tal:condition="not:template/title"
- tal:repeat="VARIABLE /here/objectValues"><td tal:content="element/id">
- tal:define="VARIABLE WERT"
- tal:omit-tag="not:template/title" -> umschliessender Tag wird bei true weggelassen
- tal:content="string:Es ist der Text" -> Direkt Text ausgeben
- tal:content="string:Das Haus ist ${context/farbe}." -> mit Variablen
- Hirarchie: define, condition, repeat, content / replace, attributes, omit-tag
Global vars:
tal:define="global myglobalvar item/Title
Get Object of an item:
item_object item/getObject
Get username:
tal:define="username context/portal_membership/getAuthenticatedMember;"
Get E-Mail address from user:
tal:define="user context/portal_membership/getAuthenticatedMember; email python:user.getProperty('email', None)"
tal:content="email" Look if myfolder/myfile exists:
tal:condition="exists: here/myfolder/myfile"
Look if myfolder/myfile not exists:
tal:condition="not: exists: here/myfolder/myfile"
get the absolute path and shows handling with strings:
string:${context/absolute_url}/mytest get the full name of the creator of an object
<span tal:define="creator context/Creator; author python:mtool.getMemberInfo(creator)" tal:content="python:author and author['fullname'] or creator">Name</span>
