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

Your name:

Reply:


Posted by Matt Warden on 09/29/12 11:20

Mark,

On 7/4/05, Mark Rogers <mark@quarella.co.uk> 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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация