RE: [SMARTY] problem with {section} tag not recognizing array
| From: | D. Sebastien Taggart | Date: | Wed, 18 Dec 2002 09:31:00 +0000 |
| Subject: | RE: [SMARTY] problem with {section} tag not recognizing array | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6866@lists.php.net to get a copy of this message | ||
Thanks, but that didn't do it; I still get blank output, and
$smarty.section.customer.show is still false. Does "customer" have to be an
index in the array?
-----Original Message-----
From: Monte Ohrt [mailto:monte@ispi.net]
Sent: Tuesday, December 17, 2002 10:15 PM
To: D. Sebastien Taggart
Cc: smarty-general@lists.php.net
Subject: Re: [SMARTY] problem with {section} tag not recognizing array
{section name=customer loop=$test1}
<tr>
<td>{$test1[customer]}</td>
</tr>
{/section}
D. Sebastien Taggart wrote:
>Hi everyone,
>
>I'm having what I'm sure must be a simple problem with {section} tags:
>
>What's happening is that the {section} doesn't repeat, as if the array is
>empty, so I tried setting up a really simple sample, but it still behaves
as
>if the array is empty:
>
>from the php file:
>
>$test1 = array( 'name' => 'sebastien', 'sex' =>
>'male');
>
>from the template file:
>
> {section name=customer loop=$test1}
> <tr>
> <td>{$test1[0]}</td>
> <td>{$test1[1]}</td>
> </tr>
> {/section}
>
>I've tried several different arrays, including:
>
>$test2 = array( 1 => array ( 'name' => 'sebastien', 'sex'
>=> 'male' ),
> 2 => array ( 'name' => 'jenny', 'sex' =>
>'female' ) );
>
>(Does the array need to be multi-dimensional?)
>
>What if I simply wanted a way to have the section repeat for a certain
>(known) number of times, like while( $row = mysql_fetch_array(
>$something ) )? I tried assigning an array with the same number of values,
>even an array with one number value, but to no avail.
>
>The manual does not supply the "sample array" ($custid) used in all the
>examples (http://smarty.php.net/manual/en/language.function.section.html),
>so it made it a little hard for me to figure out what was going on. Maybe
>that could be added in later for us beginners :).
>
>Thanks in advance for any light you could shed on this.
>
>-Sebastien
>
>
>
>
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php