Posted by Kamyk on 09/14/06 19:31
Hello!
I have the problem which solution I couldn`t have found on internet.
I have 3-dimensional array which looks like this:
$table_timeline[$j]["timeline_id_msg"][$k]=X;
$table_timeline[$j]["timeline_hour"][$k]=X
$table_timeline[$j]["timeline_minutes"][$k]=X
$j and $k are dynamic. The example of using this array is:
$table_timeline[0]["timeline_id_msg"][1]=2;
$table_timeline[0]["timeline_hour"][1]=16
$table_timeline[0]["timeline_minutes"][1]=45
$table_timeline[0]["timeline_id_msg"][2]=3;
$table_timeline[0]["timeline_hour"][2]=16
$table_timeline[0]["timeline_minutes"][2]=59
$table_timeline[0]["timeline_id_msg"][3]=4;
$table_timeline[0]["timeline_hour"][3]=16
$table_timeline[0]["timeline_minutes"][3]=13
$table_timeline[1]["timeline_id_msg"][1]=5;
$table_timeline[1]["timeline_hour"][1]=12
$table_timeline[1]["timeline_minutes"][1]=25
$table_timeline[1]["timeline_id_msg"][2]=6;
$table_timeline[1]["timeline_hour"][2]=12
$table_timeline[1]["timeline_minutes"][2]=23
As you can see the 1st dimension of the array have the following values:
value "0" has the hour 16 and various minutes and id message
value "1" has the hour 12 and various minutes and id message
I use smarty:
$smarty->assign('timeline_day', $table_timeline);
I don`t know how to get the values of the 3-rd dinemnsional array dynamicaly
in the tpl files:
I thought up a static solution which looks like this but it is not so good
for me:
{foreach name=test from=$timeline_day item=arr}
{$arr.timeline_hour.1}: {$arr.timeline_minutes.1}
{$arr.timeline_hour.2}: {$arr.timeline_minutes.2} ....
{/foreach}
I would like to get every value of the array seperatly.
I would like to change the statement {$arr.timeline_hour.1}:
{$arr.timeline_minutes.1}
to be the dynamic one i.e.: {$arr.timeline_hour.X}:
{$arr.timeline_minutes.X}
I didn`t find any solution on the internet. Please help me. I spent 5 hours
on it without any result:(
Thank you in advance for every post.
Marcin from Poland
[Back to original message]
|