smarty problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kamyk

    #1

    smarty problem

    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_ms g"][$k]=X;
    $table_timeline[$j]["timeline_h our"][$k]=X
    $table_timeline[$j]["timeline_minut es"][$k]=X

    $j and $k are dynamic. The example of using this array is:

    $table_timeline[0]["timeline_id_ms g"][1]=2;
    $table_timeline[0]["timeline_h our"][1]=16
    $table_timeline[0]["timeline_minut es"][1]=45

    $table_timeline[0]["timeline_id_ms g"][2]=3;
    $table_timeline[0]["timeline_h our"][2]=16
    $table_timeline[0]["timeline_minut es"][2]=59

    $table_timeline[0]["timeline_id_ms g"][3]=4;
    $table_timeline[0]["timeline_h our"][3]=16
    $table_timeline[0]["timeline_minut es"][3]=13

    $table_timeline[1]["timeline_id_ms g"][1]=5;
    $table_timeline[1]["timeline_h our"][1]=12
    $table_timeline[1]["timeline_minut es"][1]=25

    $table_timeline[1]["timeline_id_ms g"][2]=6;
    $table_timeline[1]["timeline_h our"][2]=12
    $table_timeline[1]["timeline_minut es"][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('timeli ne_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


Working...