[PHPTAL] unknown keys in an array

Luciano Andrade andrade.luciano at gmail.com
Tue Jun 20 19:12:08 CEST 2006


i need to make a table with a multidimensional array
$content = array();
$months =  array(1 => 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
$codes = getFromDB(....); //An array of code

foreach($months as $nMonth => $tMont){
   foreach($codes as $kCode => $code){
       $content[$kCode][$nMonth] = CalculateIT($kCode,$nMonth);
   }
}

and i need a table to looks like

<table>
<tr><? foreach($months as $tMont) echo "<td>$tMonth</td>"; ?></tr>
<?
foreach($codes as $kCode => $code){
echo "<tr><td>$code</td>";
foreach($months as $nMonth => $tMont){
 echo "<td>".$cotent[$kCode][$nMonth]."</td>";
}
echo "</tr>";
}
echo "</table>";

sugestions please.

?>



More information about the PHPTAL mailing list