On 09-09-2008 at 10:57:24 Zbyněk Nevrlý <[EMAIL PROTECTED]> wrote:
Hello,
I have question about syntax iterable objects. Here is code:
<div id="MText" tal:condition="php: language == 'cz'" tal:repeat="item
itemsList" tal:content="item/poznamka">foo value</div>
Well, I want to format value "item/poznamka" by PHP standard function, so
when item is object I can use "php: item.getPoznamka()" but when is
ItemList is array?
It doesn't matter what type of itemsList is, only type of the item
variable matters.
Code: tal="php: nl2br(item/poznamka)" is not working. Maybe is it in
manual but I cant find it. Thanks a lot.
when you use php: modifier, you can't use slashes. You must use PHP syntax
(with some python-like exceptions) that php: modifier requires.
If item is an array, then this should work:
tal:content="structure php:nl2br(htmlspecialchars(item['poznamka']))"
structure keyword is needed to have <br/> interpreted as HTML, rather than
displayed to the user as text.
Assuming item['poznamka'] is just plain text, then htmlspecialchars() is
needed to convert < and & characters to HTML-safe equivalents.
--
regards, Kornel
_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal