Re: [SMARTY] Bug in Smarty 2.5.0rc1
| From: | Nichlas Löfdahl | Date: | Thu, 06 Mar 2003 13:06:48 +0000 |
| Subject: | Re: [SMARTY] Bug in Smarty 2.5.0rc1 | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8439@lists.php.net to get a copy of this message | ||
Greetings Rob!
This should work:
{assign var="cat_id" value=$catagorys[i].catagory_id}
{assign var="cat_id" value=$catagorys.i.catagory_id}
Inside quotes you need to backquote the array-names, like this:
{assign var="cat_id" value="$
catagorys[i].catagory_id}
or
{assign var="cat_id" value="$catagorys.i.catagory_id}
Hope it helps
/Nichlas
----- Original Message -----
From: "Rob Schultz" <schultzr@kattare.com>
To: <smarty-general@lists.php.net>
Sent: Thursday, March 06, 2003 1:32 PM
Subject: [SMARTY] Bug in Smarty 2.5.0rc1
> In Smarty 2.4.2 this worked and now it doesn't
>
> {section name=i loop=$catagorys}
> <a name='{$catagorys[i].catagory_id}'></a>
> <tr>
> <th>{$catagorys[i].catagory_name}</th>
> </tr>
> <tr>
> <td align='center'>
> <table border='0' cellspacing='0' cellpadding='0'
> width='95%'>
> {assign var="cat_id" value="$catagorys[i].catagory_id"}
> {section name=id loop=$faqs[$cat_id]}
> <tr><td width='72' class='table'>Question:</td><td
> class='table'>{$faqs[$cat_id][id].faq_question}</td></tr>
> <tr><td width='72' class='table'>Answer:</td><td
> class='table'>{$faqs[$cat_id][id].faq_answer}</td></tr>
> {/section}
> </table>
> </td>
> </tr>
> {/section}
>
> $cat_id in Smarty 2.4.2 was actually assigned as the variable.. Now its
> assigned this "Array[i].catagory_id"
>
> Is this a problem with the new syntax updates or do I need to go about
> another method.. The arrays are as follows..
>
> {$catagorys}
> Array (3)
> 0 => Array (2)
> catagory_id => 7
> catagory_name => Name 1
> 1 => Array (2)
> catagory_id => 6
> catagory_name => Name 2
> 2 => Array (2)
> catagory_id => 8
> catagory_name => Name 3
>
>
> {$faqs}
> Array (2)
> 7 => Array (5)
> 0 => Array (2)
> faq_question => Question 1
> faq_answer => Answer 1
> 1 => Array (2)
> faq_question => Question 2
> faq_answer => Answer 2
> 2 => Array (2)
> faq_question => Question 3
> faq_answer => Answer 3
>
> That is just part of the array..
>
> Thanks..
> Rob Schultz
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php