Re:RE: Bug, or bad coding?
| From: | Brian E. Lozier | Date: | Mon, 12 Nov 2001 08:38:29 +0000 |
| Subject: | Re:RE: Bug, or bad coding? | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-1903@lists.php.net to get a copy of this message | ||
That seems to have worked perfectly, although I can't claim to understand why. Oh well :P
Thanks a ton, I
appreciate the help.
Brian
========================
The Massassi Temple
http://www.massassi.net/
"How should I know if it works? That's what beta testers are for. I only coded it." -
Linus Torvalds
----- Original Message -----
From: "Jimmy Harlindong" <jimmy@harlindong.com>
To: smarty@lists.ispi.net
Date: 11/11/01 9:32:48 PM
>
>You probably need this instead
>
> {section name=row loop=$Posts[rows]}
>
>Cheers
>
>> -----Original Message-----
>> From: Brian E. Lozier [mailto:brian@massassi.net]
>> Sent: Monday, 12 November 2001 12:04 PM
>> To: smarty@lists.ispi.net
>> Subject: [smarty] Bug, or bad coding?
>>
>>
>> I've been working with Smarty a ton lately and I've grown to
>> love it. The problem I'm having, however, is
>> that a nested {section} is looping 3 times while the
>> count($array) returns 4. So, I get the first 3 elements
>> printed properly on the first loop, then a blank at the very
>> end. Here is the offending template:
>>
>> {section name=rows loop=$Dates}
>> <p><font size="+1">{$Dates[rows]}</font></p>
>> {section name=row loop=$Posts}
>> <table>
>> <tr>
>> <td
>> bgcolor="#CCCCCC">{$Posts[rows][row].newsHeadline}</td>
>> <td>{$Posts[rows][row].userID}</td>
>> </tr>
>> </table>
>> <p>{$Posts[rows][row].newsText}</p>
>> {/section}
>> {/section}
>>
>> Here is the code on my assigns:
>>
>> $tpl->assign("Dates", $displayDates);
>> $tpl->assign("Posts", $displayPosts);
>>
>> And a count($displayDates) returns 3 (and it's looping 3
>> times), and here are the counts of the following:
>> count($displayPosts[0]) = 4
>> count($displayPosts[1]) = 3
>> count($displayPosts[2]) = 2
>>
>> The problem is, it's looping through "Posts"
>> ($displayPosts[0]) 3 times instead of 4. Then, it's printing a
>> blank "section" at the very bottom (the HTML printing but no values).
>>
>> Any help would be greatly appreciated. If you need more of
>> the code, I'd be happy to provide it.
>>
>> Brian
>
>
>---
>You are currently subscribed to smarty as: brian@massassi.net
>To unsubscribe send a blank email to $subst('Email.Unsub')
>Visit Smarty's homepage at
>http://www.phpinsider.com/php/code/Smarty/