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

List:       smarty-general
Subject:    [SMARTY] Loops
From:       "Erich Beyrent" <erich.beyrent () beyrent ! net>
Date:       2004-03-12 16:36:39
Message-ID: 003a01c40850$355782f0$3664a8c0 () PERRIN
[Download RAW message or body]

Hi all,

I don't know why I have so much trouble with Smarty and arrays...  Let's
assume I have the following data structure:

$EVENTS = array('event1' => array('dow' => "Saturday",
				          'month' => "March",
					    'day' => "13",
					    'year' => "2004",
					    'time' => "6:00 PM",
					    'title' => "St. Patrick\'s
Day Supper",
				          'location' => "Fellowship
Hall",
					   ),
		   'event2' => array('dow' => "Saturday",
					   'month' => "March",
				         'day' => "27",
					   'year' => "2004",
					   'time' => "7:30 PM",
					   'title' => "Michael Nix
Concert",
					   'location' => "Sanctuary",
					  ),
               );

How would I loop through all of the events in my template?

I tried this:

// Loop through each event
{section name=i loop=$Events}
  // Loop through the values for each event
  {section name=j loop=$Events[i]}
    {$Events[i][j].title}<br>
{/section}

Which didn't work.  Tips?  Suggestions?  As always, thanks in advance!

-Erich-

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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

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