Re: [SMARTY] {section} docs, was: Re: [SMARTY] Newbie Question: Associative Arrays and Sections

Matt Warden <[email protected]>
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
Mark,

On 7/4/05, Mark Rogers <[email protected]> wrote:
>     In most cases, and in ALL cases involving associative
>     (non-numeric indexed) arrays or numerical indexes
>     which don't increment from zero, you should use
>     {foreach} rather than {section}.
> 

I have looked at the docs for section and foreach many times, and
while I had a general intuition for how to use each, *when* to use
each hadn't become clear until I read this (and the previous mention
from maju(I think) about only using arrays indexed from 0...n-1).

Definitely a +1 for the note added to the docs.

In fact, I was primarily mislead by this note in the docs:

"The syntax for {foreach} is much easier than {section}, but as a
tradeoff it can only be used for a single array."

which, to me, implies that they serve the same purpose and can be used
on the same array types, with the caveat being noted.

-- 
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.