[Templates] Determining variable types in TT
Ronald J Kimball
rkimball+tt at pangeamedia.com
Wed Oct 3 20:43:56 BST 2007
Is it possible to determine the type of a variable in TT?
For example, give the following data:
$structure = [ 1, 2, [3, 4], 5, [6], 7];
While iterating over that structure in TT, how could I tell whether each
item is a scalar or a list?
[% FOREACH item IN structure %]
[% IF ??? %]
It's a scalar!
[% ELSE %]
It's a list!
[% END %]
(What I'm trying to do is create a block to traverse the structure
recursively.)
thanks,
Ronald
More information about the templates
mailing list