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

List:       smarty-general
Subject:    Re: [SMARTY] Loops
From:       "Mark Rogers" <mark () quarella ! co ! uk>
Date:       2004-03-15 10:31:19
Message-ID: 008401c40a78$a79aa660$1100000a () mark
[Download RAW message or body]

Erich Beyrent writes:
> I see, he says.  Is it more advantageous for me to simply change the data
> structure to this [...]

Each to his own; I don't think I ever use section, as I find having
meaningful array keys useful, and even when they are simply numerical
foreach copes just as well as section. Indeed, having used Smarty for some
time I couldn;t tell you the syntax for section without looking it up.

On the other hand, I suspect that section is more commonly used (from the
comments and sample code I've seen).

If you typically have meaningful array keys, use foreach. If you don't, use
section.

To me,
    {foreach from=$Events item=event}
        {$event.title}
    {/foreach}

.. just "makes sense", even for numerical keys.
-- 
Mark Rogers,
More Solutions Ltd :: Tel: 0845 45 89 555

-- 
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