Multi-dimension array in nested sections

From: Date: Fri, 29 Jun 2001 08:25:47 +0000
Subject: Multi-dimension array in nested sections
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1086@lists.php.net to get a copy of this message
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

Attachment: [application/ms-tnef] winmail.dat
« previous php.smarty.general (#1086) next »