[Catalyst] Relationship layout

Will Smith willbelair at yahoo.com
Wed Oct 5 21:01:27 CEST 2005


I've tried that, and read all the Manuals/Tutorials/Intro
In the sub beatle i have:
------
$c->stash->{artist} = music::M::CDBI::Artist->search_like(name=>'%beatle%');
-----
in the template i have:
 
[% mycd = artist.next %]
    [% mycd.name %]  ######## i get this value right
has    
[% FOREACH cd = artist.cds %] #### access the cd table
[% cd.title %] ######## i cannot get this one. Just nothing
[% END %]
 
I don't know what do I miss. 
 
Thanks
Matt S Trout <dbix-class at trout.me.uk> wrote:
On Wed, Oct 05, 2005 at 08:09:42PM +0200, Andreas Marienborg wrote:
> If you have set the $c->stash->{artist} correctly, you should be able 
> to do the following in your template:
> 
> [% artist. %]
> 
> if you use Template Toolkit
> 
> for instance:
> 
> [% artist.name %]
> 
> if artist has a field "name".

And if artist has_many cds, then

[% FOREACH cd = artist.cds %]

might also be useful :)

You really want to read the Template Toolkit POD carefully about the way
it handles arrays and hashes and how the various loop directives etc. work
- I've never found a need to use EVAL_PERL provided I refreshed my memory
from the POD beforehand if I was trying to do something complex.

-- 
Matt S Trout Specialists in perl consulting, web development, and
Technical Director UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

_______________________________________________
Catalyst mailing list
Catalyst at lists.rawmode.org
http://lists.rawmode.org/mailman/listinfo/catalyst

		
---------------------------------
Yahoo! for Good
 Click here to donate to the Hurricane Katrina relief effort. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20051005/31ea4bfb/attachment-0001.htm


More information about the Catalyst mailing list