Share » Forums » General » variable variables

variable variables

variable variables

Thursday 30 March 2006 8:33:25 am - 2 replies

Author Message

J Jones

Tuesday 07 August 2007 8:35:20 am

This is an old post I know. And I don't even have a solution.

I need to change the value for a dynamic variable being used in a foreach-loop.

So that I can access i.e. $myvariable later on the page. But there seems to be no option to do this with variables in EZ.

It even surprises me more that I seem to be one of the few who would need this?

Jesper

Patrick Kaiser

Tuesday 07 August 2007 12:32:37 pm

At least for my original problem I found the solution in between.
Given the case you want to access attributes that follow a certain naming convention (ie. attribute_1, attribute_2, attribute_3, etc) you could do the following:

{def $attribute_pre='attribute_' $tmp=''}
{for 0 to 4 as $number}
  {set $tmp=concat( $attribute_pre, $number )}
  {$node.data_map[$tmp].content}
{/for}


Best regards,

Patrick

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu