[Catalyst] Relationship layout

Matt S Trout dbix-class at trout.me.uk
Wed Oct 5 20:48:55 CEST 2005


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.<FIELD> %]
> 
> 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/ +



More information about the Catalyst mailing list