Re: php array -> TAL path:
Kornel Lesiński <
kornel@...>
2008-10-09 09:22:03 GMT
On 08-10-2008 at 23:57:05 Axel Zöllich <faxel@...> wrote:
> abc.php:
> $ergebnis = $mysqli->query("SELECT * FROM farbe");
> while ($zeile = $ergebnis->fetch_object()) {
> $typen[farben][][kuerzel] = $zeile->kuerzel;
> $typen[farben][][bez] = $zeile->bez;
> }
On each loop iteration you're creating two array elements in
$typen[farben], one with *only* "kuerzel" key, and another one with *only*
"bez" key.
Your PHPTAL template seems to expect that every array element has both
keys. If you wanted both keys in one element, then use something like this:
$typen['farben'][] = array(
'kuerzel'=>$zeile->kuerzel,
'bez'=>$zeile->bez,
);
and if you really want array with keys interlaced, then add
tal:condition="exists:farbe/bez" and tal:condition="exists:farbe/kuerzel"
on elements which use these expressions.
--
--
regards, Kornel