Sarteck
06-20-2011, 04:57 AM
If I have a multi-dimensional array, how would I go about using it in a template?
For example, let's say I have a regular array of Userinfo. I know that I can get the musername simply by:
{vb:raw userinfo.musername}
Now let's say I have an array called $users. This array has key => value as User ID => Userinfo
Also, let's say I have a variable called $userid.
How would I get the value of $users[$userid]['musername'] in a template?
Would it be as simple as {vb:raw users.{vb:raw userid}.musername}?
--------------- Added 1308564538 at 1308564538 ---------------
I've found this post (https://vborg.vbsupport.ru/showpost.php?p=1916356&postcount=16) by cellarius that says that multidimensional arrays do work in templates, but it doesn't give a example (or say it's even possible) to do something like I mentioned--that is, using a variable as one of the keys of an array.
For example, let's say I have a regular array of Userinfo. I know that I can get the musername simply by:
{vb:raw userinfo.musername}
Now let's say I have an array called $users. This array has key => value as User ID => Userinfo
Also, let's say I have a variable called $userid.
How would I get the value of $users[$userid]['musername'] in a template?
Would it be as simple as {vb:raw users.{vb:raw userid}.musername}?
--------------- Added 1308564538 at 1308564538 ---------------
I've found this post (https://vborg.vbsupport.ru/showpost.php?p=1916356&postcount=16) by cellarius that says that multidimensional arrays do work in templates, but it doesn't give a example (or say it's even possible) to do something like I mentioned--that is, using a variable as one of the keys of an array.