Skip to content

Instantly share code, notes, and snippets.

@youssman
Last active August 29, 2015 14:08
Show Gist options
  • Save youssman/5bfdb42cbac4ad0fc438 to your computer and use it in GitHub Desktop.
Save youssman/5bfdb42cbac4ad0fc438 to your computer and use it in GitHub Desktop.
escape HTML tags in phpTal
<!-- ... -->
<!-- You have to use ${structure expresssion} syntax to escape HTML tags.
The use of "tal:define" (to handle the case when no string is defined in the array) is important
because we can't combine the two PHPTALES "structure" and "string" in the same expression. -->
<div tal:define="myVarWithTags string:a br tag<br/>for example">
${structure myArray/ofString | myVarWithTags}
</div>
<!-- ... -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment