Women in Technology

Hear us Roar



Article:
  The Dynamic Duo of PEAR::DB and Smarty
Subject:   a cleaner looping syntax
Date:   2003-04-22 06:50:26
From:   anonymous2
FWIW for looping through arrays in Smarty templates I prefer this syntax, which is a bit more readable:


{foreach from=$widgets item=widget}
{$widget.name} : {$widget.price}

{/foreach}


I enjoyed the tricks relating to bulk assignment of template variables.

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • a cleaner looping syntax (or is it?)
    2003-04-23 19:46:25  jcpm [View]

    I guess it's a matter of personal option to say that the {foreach} syntax is more readable than the {section} one.

    I personally prefer the {section} one, and that is why I use it all over this article.

    Cheers,
    Joao Prado Maia