[Catalyst] little syntax

Jim Spath jspath at pangeamedia.com
Thu Apr 12 17:59:51 GMT 2007


Hi Will,

You want:

  $c->stash->{recs} = \@records;

And then to access it in the Template Toolkit template, you want:

  [% FOREACH row IN recs %]
   id: [% row.id %]
   name: [% row.name %]<br />
  [% END %]

And you should probably check out the following two URLs for more info 
on Catalyst + Template Toolkit.

  http://search.cpan.org/dist/Catalyst-Manual/
  http://www.template-toolkit.org/docs/plain/Manual/index.html

- Jim

Will Smith wrote:
> I have the following piece of code:
>  
>  # in controller
>  ...
>  while ( my $row = $file->read ) {
>  push @record, {
>  id => $row->{id},
>  name => $row->{name},
>  };
>  }
>  $c->stash->{recs} = @records;
>  .....
>  
>  What is the syntax on the tt2 to access the id and name?
>  Or please point me to somewhere that I could do some reading on the question.
>  
>  Thank you

-- 
Jim Spath
Lead Developer
Pangea Media
Em: jspath at pangeamedia.com
Ph: 617.314.6687
Fx: 617.390.7824
IM: panJimS (AIM)



More information about the Catalyst mailing list