multidimensional loop in raintpl

364 views
Skip to first unread message

rainbow

unread,
May 27, 2014, 5:27:38 AM5/27/14
to rai...@googlegroups.com
Q1: 
Variables can be either one-dimensional (strings, numbers, boolean values) and multidimensional (arrays, objects).
To access array values use the dot operator "." and to access object values use the arrow operator "->".
To access array use the {loop} tag.

any example to loop multidimensional array? and also arrow operator "->"?

Q2:
$abc['id'] = '123';
$def['123'] = "other thing";

 {loop="abc"}
   {$def.$value.id} <-- how to put 1st array's ID into 2nd array and display value "other thing" ?
 {/loop}


Federico Ulfo

unread,
May 27, 2014, 8:02:18 PM5/27/14
to raintpl
Hi Rainbow, 

this will work:

{loop="$abc"}
   {$key} // this print id
   {$value} // this print 123

   // so this will select $def["123"]
   {$def["$value"]}
{/loop}

the -> operator is to access objects, for example if $abc was a class you could have access its properties with:

$abc->id

Hope that clarify.


--
--
www.RainTPL.com
group at http://groups.google.com/group/raintpl
unsuscribe at raintpl+u...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "raintpl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to raintpl+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages