[prev in list] [next in list] [prev in thread] [next in thread] 

List:       smarty-general
Subject:    [smarty] Multi-dimension array in nested sections
From:       "Paul Bennett" <paul () approach-computing ! co ! uk>
Date:       2001-06-29 8:25:47
[Download RAW message or body]

I'm relatively new to Smarty and want to create a template to display a
calendar.  I have created an array as follows:

for ($j=8; $j < 18; $j++)
{
   $x = array();
   $x[time]=$j . ":00";

   for ($i=0; $i < 7; $i++)
   {
      $y[matrix]="events";
      array_push($x, $y);
   }
   array_push($str, $x);
}

and now want to display a matrix of 10 rows (hours of day) x 7 cols (days of
week) with each cell containing the events held in the array.

I have tried the following in my template, but cannot access the value of
the 'matrix' key in the second (inner) section.

{section name=sec1 loop=$str}
   <TR><TD>{$str[sec1].time}</TD>
     {section name=sec2 loop=7}
        <TD>{%sec2.index%} - {$str[sec1].time[{%sec2.index%}].matrix}</TD>
     {/section}
  </TR>
{/section}

I'm pretty sure that I'm missing something simple, either in the creation of
the array or the section in the template.  Any Ideas?


Woodgnome



["winmail.dat" (application/ms-tnef)]

---
You are currently subscribed to smarty as: smarty@progressive-comp.com
To unsubscribe send a blank email to leave-smarty-700385W@lists.ispi.net
Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic