Re: [SMARTY] Problem with nested sections on multidimensional associative arrays

From: Date: Wed, 24 Apr 2002 13:54:05 +0000
Subject: Re: [SMARTY] Problem with nested sections on multidimensional associative arrays
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3863@lists.php.net to get a copy of this message
Ingmar Heinrich wrote:
Hi. My debug looks like that: {$group} Array (8) 0 => Array (2) GroupName => A game => Array (6)
    0 => Array (14)
      GameId => 1
        ...
    1 => Array (14)
      GameId => 3
        ...
    2 => Array (14)
      GameId => 18
        ...
    3 => Array (14)
      GameId => 20
        ...
    4 => Array (14)
      GameId => 33
        ...
    5 => Array (14)
      GameId => 34
        ...
1 => Array (2) GroupName => B game => Array (6)
    6 => Array (14)
      GameId => 6
        ...
    7 => Array (14)
      GameId => 8
        ...
.. and so on. I get the outer section with {section name="group" loop=$group} which works well: <tr> <td colspan="7" bgcolor="white">Gruppe {$group[group].GroupName}</td> </tr> Then I try to do the inner loop: {section name="game" loop=$group[group].game} Seems to be the correct syntax, since the number of iterations is correct. But how do I address the inner values now?? I tried many ways, such as <td>{$group[group][game].GameId}</td>
You have to reference the array "game" somehow, and naming your section "game" is probably causing confusion. Try this: {$group[group].game[game].GameId}
- no output. I'm sure it's rather trivial, but I just don't grasp it. Some please HEEEELP :o) Regards, Ingmar -- Ingmar Heinrich <ingmar.heinrich@hamburg.de>
-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

« previous php.smarty.general (#3863) next »