The proper way to script multidimension multi values array in template

62 views
Skip to first unread message

Roy H.G.

unread,
Nov 22, 2017, 6:42:06 AM11/22/17
to Fat-Free Framework
Hi f3 Users,

How to script multidimesion multi values array in template?

Lets say I have variable @POST.var1.var2.@row.var3..
How to script properly in templates?
Cause I have error results..

<input value="{{@POST.var1.var2.@row.var3}}"' />

How I can achieve input value with multiple value like below?
@POST.var1.var2.0.var3,
@POST.var1.var2.1.var3,
@POST.var1.var2.2.var3 

regards,
Roy.

ved

unread,
Nov 22, 2017, 8:30:24 AM11/22/17
to Fat-Free Framework
Maybe this ?

<repeat group="{{ @POST.var1.var2 }}" value="{{ @val }}">
   
<input value="{{@val.var3}}"' />
</repeat>

Roy H.G.

unread,
Nov 23, 2017, 2:27:42 PM11/23/17
to Fat-Free Framework
Hi Ved,
Thanks for ur suggestions!
I forgot to try like yours.
Actually the @row is come from another repeat group that I want to use in inside @POST value.

ved

unread,
Nov 23, 2017, 5:37:48 PM11/23/17
to Fat-Free Framework
Thanks for ur suggestions!

Actually the @row is come from another repeat group that I want to use in inside @POST value.

No problem.
I assumed that @row would probably already be derived from a <repeat> block. But you can still have nested repeats.
Was your problem solved?

ikkez

unread,
Nov 24, 2017, 5:05:15 AM11/24/17
to Fat-Free Framework
so you meant something like {{@POST.var1.var2[@row].var3}} ?

Roy H.G.

unread,
Nov 27, 2017, 6:04:36 AM11/27/17
to Fat-Free Framework
Yes..
But it results empty..
<loop from="{{@i=1}}" to="{{@i<50}}" step="{{ @i++ }}">
<div class='ui sidebar{{@i}}'><set vendor='ads' id='{{@ads.id}}' slot='{{@ads.slot[@i]}}'/></div>
</loop>
How can I get the i repetition values as variable to be placed in @ads.slot[1..50] or @ads.slot.1..50?

ved

unread,
Nov 27, 2017, 6:53:41 AM11/27/17
to Fat-Free Framework
Why are you now using <loop> instead of <repeat>?

You're making things more confusing for us and you're not giving enough information about what you want.

Please let us know exactly in which format your initial array is (a var_export() would help) and what output do you wish to display with it.
Reply all
Reply to author
Forward
0 new messages