On 8/2/05, Jason Gottshall <[EMAIL PROTECTED]> wrote:
> I've run into this problem with other 3rd-party object methods that
> return lists instead of arrayrefs; when there's more than one item, TT
> collapses them into an arrayref, which is great. But if there's only one
> item, you just get that item by itself, not in a list. Obviously
Check the Template::Manual::VMethods docs and search for the 'list' method:
list
Return the value as a single element list. This can be
useful if you have a variable which may contain a single item or a
list and you want to treat them equally. The 'list' method can be
called against a list reference and will simply return the original
reference, effectively a no-op.
[% thing.list.size %] # thing can be a scalar or a list
Cheers,
Cees
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates