Re: Smarty problem with hasMany associations

2007-03-10 Thread Kyo

Tarique, your reply solved my problem.
Like you said, I put a nested loop into the first multi dimentional
arrays,
and then foreach into the second one.

{section name=val loop=$data}
{$data[val].User.first_name}
{foreach from=$data[val].Comment item=comment}
{$comment.body}
{/foreach}
{/section}

Thanks for the help, Tarique!


On 3月10日, 午後9:37, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On 3/10/07, Kyo <[EMAIL PROTECTED]> wrote:
>
> > Thanks for your reply, Tarique.
> > I am curious as to how foreach would access to keys(e.g. [0],[1],[2])
> > in a multi-dimensional associative arrays.
>
> Ummm... may be I was not clear - first multi dimentional arrays will
> need nested a loop
> second you will need to use foreach for the comments part the key in
> that case will be irrelevant
>
> HTH
> Tarique
>
> --
> =
> PHP for E-Biz:http://sanisoft.com
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> =


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Smarty problem with hasMany associations

2007-03-10 Thread Kyo

Since I currently use cakePHP 1.1 for my project, I don't know much
about Set::extract.
I'll go for cakePHP 1.2 when it's ready to fly.  Thanks for your
suggestion anyway, Mariano.

On 3月10日, 午後10:04, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> Unless you use CakePHP 1.2, and take advantage of the beauty of
> Set::extract.
>
> -MI
>
> ---
>
> Remember, smart coders answer ten questions for every question they ask.
> So be smart, be cool, and share your knowledge.
>
> BAKE ON!
>
> blog:http://www.MarianoIglesias.com.ar
>
> -Mensaje original-
> De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
> de Dr. Tarique Sani
> Enviado el: Sábado, 10 de Marzo de 2007 09:38 a.m.
> Para: cake-php@googlegroups.com
> Asunto: Re: Smarty problem with hasMany associations
>
> Ummm... may be I was not clear - first multi dimentional arrays will
> need nested a loop
> second you will need to use foreach for the comments part the key in
> that case will be irrelevant


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Smarty problem with hasMany associations

2007-03-10 Thread Mariano Iglesias

Unless you use CakePHP 1.2, and take advantage of the beauty of
Set::extract.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de Dr. Tarique Sani
Enviado el: Sábado, 10 de Marzo de 2007 09:38 a.m.
Para: cake-php@googlegroups.com
Asunto: Re: Smarty problem with hasMany associations


Ummm... may be I was not clear - first multi dimentional arrays will
need nested a loop
second you will need to use foreach for the comments part the key in
that case will be irrelevant


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Smarty problem with hasMany associations

2007-03-10 Thread Dr. Tarique Sani

On 3/10/07, Kyo <[EMAIL PROTECTED]> wrote:
> Thanks for your reply, Tarique.
> I am curious as to how foreach would access to keys(e.g. [0],[1],[2])
> in a multi-dimensional associative arrays.

Ummm... may be I was not clear - first multi dimentional arrays will
need nested a loop
second you will need to use foreach for the comments part the key in
that case will be irrelevant

HTH
Tarique

-- 
=
PHP for E-Biz: http://sanisoft.com
Cheesecake-Photoblog: http://cheesecake-photoblog.org
=

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Smarty problem with hasMany associations

2007-03-10 Thread Kyo

Sorry for the types in my last post.
The Comment part should be:

{section name=val loop=$data.Comment}
{$data[val].Comment.???.body}// HERE!!
{/section}


Thanks for your reply, Tarique.
I am curious as to how foreach would access to keys(e.g. [0],[1],[2])
in a multi-dimensional associative arrays.


The following code only retrieves a key of 0.
How do you retrieve each key?

{foreach from=$data item=val}
{$val.Comment.0.body}
{/foreach}


On 3月10日, 午後5:56, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On 3/10/07, Kyo <[EMAIL PROTECTED]> wrote:
>
> > {section name=val loop=$data.FileUpload}
> > {$data[val].Comment.???.body} // HERE!!
> > {/section}
>
> Its been a while since I worked withsmartybut try using the
> {foreach} syntax instead of {section}
>
> HTH
> Tarique
>
> --
> =
> PHP for E-Biz:http://sanisoft.com
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> =


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Smarty problem with hasMany associations

2007-03-10 Thread Dr. Tarique Sani

On 3/10/07, Kyo <[EMAIL PROTECTED]> wrote:
> {section name=val loop=$data.FileUpload}
> {$data[val].Comment.???.body} // HERE!!
> {/section}

Its been a while since I worked with smarty but try using the
{foreach} syntax instead of {section}

HTH
Tarique

-- 
=
PHP for E-Biz: http://sanisoft.com
Cheesecake-Photoblog: http://cheesecake-photoblog.org
=

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---