Forums / General / Determine attributes in a class
Lars Eirik R
Monday 22 March 2010 7:48:30 am
What is the best way to check if a class contains an attribute when iterating through an array of objects in a tpl?
I have tried to do something like this {if $node.data_map.mytest}
The problem is that i get errors whenever my node does not currenctly contain a mytest attribute.
Please help.
Norbert Wagner
Tuesday 23 March 2010 3:53:05 am
Hi Lars,did you try
{if is_set($node.data_map.mytest}
Tuesday 23 March 2010 4:46:53 am
Hm. thanks for helping.
I tried it now, but still get the same problem.. it reports errors if mytest does not exist
Nicolas Pastorino
Wednesday 24 March 2010 4:02:13 am
Another option :
{if is_unset( $node.data_map.mytext)|not}
Tried it yet ?
-- Nicolas Pastorino Director Community - eZ Member of the Community Project Board eZ Publish Community on twitter: http://twitter.com/ezcommunity t : http://twitter.com/jeanvoye G+ : http://plus.tl/jeanvoye