Hi all, I have a Smarty problem with hasMany associations.

I have an association between the User and Comment models just like
the sample in the cake manual (http://manual.cakephp.org/chapter/
models) and get the following output:

Array
(
    [User] => Array
        (
            [id] => 25
            [first_name] => John
            [last_name] => Anderson
            [username] => psychic
            [password] => c4k3roxx
        )

        [Comment] => Array
        (
            [0] => Array
                (
                    [id] => 247
                    [user_id] => 25
                    [body] => The hasMany assocation is nice to have.
                )

            [1] => Array
                (
                    [id] => 256
                    [user_id] => 25
                    [body] => The hasMany assocation is really nice to
have.
                )

        )

)


The problem is this:

I have this in my view template (Smarty):

// In this section part, it can access to the value User.first_name
{section name=val loop=$data}
{$data[val].User.first_name}
{/section}

// Here is the Comment part where I have a problem
// I need the Comment data from the output in my template but I am
stuck on it.

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


I don't see how it can solve the problem.
Any help is appreciated!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to