Re: [SMARTY] {section} -> {foreach}
| From: | Robert | Date: | Thu, 03 Mar 2005 13:19:27 +0000 |
| Subject: | Re: [SMARTY] {section} -> {foreach} | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12290@lists.php.net to get a copy of this message | ||
"Mark Rogers" <mark@quarella.co.uk> wrote in message
news:04e801c51f46$d79587c0$1100000a@mark...
> Robert writes:
>> How do I convert this to a {foreach}?
>
> Off the top of my head:
>
> {foreach from=$pageData.data item=item}
> <tr class="{cycle values="trcol1,trcol2"}">
> <td>{$item.SURNAME}</td>
> <td>{$item.FIRST_NAME}</td>
> <td>{$item.USERID}</td>
> <td>{$item.PROFILE}</td>
> <td>{$item.POSITION}</td>
> {if $item.PRIMARY eq 1}
> <td>No</td>
> {elseif $item.PRIMARY eq "0"}
> <td>Yes</td>
> {else}
> <td> </td>
> {/if}
> </tr>
> {/foreach}
>
> --
Thanks Mark! That worked right out of the box and fixed another problem
being caused by the {section}.
Robert