On 24/02/10 21:43, Summer wrote:
This WILL NOT work and I constantly get an error of: unexpected token (_)

[% someArray = [] %]
[% someArray = ["Item1","item2: " _ pageItems.section,"color"] %]


You could put the complex expression inside a vmethod. It's not pretty and I'm sure there's a better option than .replace here but:

[% str = ""; someArray = ["Item1",str.replace("", "item2: " _ pageItems.section), "color"] %]

(since str isn't modified you can use this same approach multiple times in the same definition). If you're going to use this a lot then perhaps better to modify the parser to allow expressions in () brackets, such as [ (scalar1 _ scalar2) ].

Tom

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to