Thank you very much, Peter.

Yeah i use $c->stash->{books} = [$c->model('MyAppDB::Book')->all] in my
template and it works. I just want to make too many changes in the result of
it before send them to my TT. Now ill try what you wrote here. Thank you
again.

Angel


2007/12/8, Peter Edwards <[EMAIL PROTECTED]>:
>
>  Angel,
>
>
>
> I'd recommend working through the tutorial, it explains many things
>
>
> http://search.cpan.org/~jrockway/Catalyst-Manual-5.701003/lib/Catalyst/Manual/Tutorial.pod<http://search.cpan.org/%7Ejrockway/Catalyst-Manual-5.701003/lib/Catalyst/Manual/Tutorial.pod>
>
>
>
> Looking at your code, on each iteration with $line in $rs->next you are
> setting the entire body, overwriting whatever you put in the previous time.
> So you end up only showing the last row found. Something like this would
> show all the lines
>
>
>
>   $c->response->body( $c->response->body . $line->first_name . "\n" );
>
>
>
> In practice you put DBIC objects like $rs in the stash and call DBIC
> methods on them from inside your TT templates.
>
>
>
> In the tutorial in the controller:
> http://search.cpan.org/~jrockway/Catalyst-Manual-5.701003/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod#CREATE_A_CATALYST_CONTROLLER<http://search.cpan.org/%7Ejrockway/Catalyst-Manual-5.701003/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod#CREATE_A_CATALYST_CONTROLLER>
>
>
>
>   $c->stash->{books} = [$c->model('MyAppDB::Book')->all];
>
>
>
> And then further down the tutorial inside the template:
> http://search.cpan.org/~jrockway/Catalyst-Manual-5.701003/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod#Create_a_TT_Template_Page<http://search.cpan.org/%7Ejrockway/Catalyst-Manual-5.701003/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod#Create_a_TT_Template_Page>
>
>
>
> [% FOREACH book IN books -%]
>
> <tr>
>
>         <td>[% book.title %]</td>
>
>         <td>[% book.rating %]</td>
>
> ...
>
> </tr>
>
> [% END -%]
>
>
>
>
>
> Subscribe to the DBIx::Class user and developer list at
> http://lists.scsys.co.uk/mailman/listinfo/dbix-class
>
>
>
> DBIC documentation map at
>
>
> http://search.cpan.org/~blblack/DBIx-Class-0.07006/lib/DBIx/Class/Manual/DocMap.pod<http://search.cpan.org/%7Eblblack/DBIx-Class-0.07006/lib/DBIx/Class/Manual/DocMap.pod>
>
>
>
>
>
> Regards, Peter
>
> http://perl.dragonstaff.co.uk
>
>
>
> ________________________________________
>
> From: Angel Kolev [mailto:[EMAIL PROTECTED]
>
>
>
> Sorry but im just badly stucked at this :(
>
> I want to iterate using the model
>
>
>
> my $rs = $c->model('AppModelDB::ClientMale')->search();
>
> while (my $line = $rs->next) {
>
>       $c->response->body($line->first_name);
>
> }
>
>
>
> The result is always one name. I need all fields them to put them in TT
> template.
>
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/[EMAIL PROTECTED]/
> Dev site: http://dev.catalyst.perl.org/
>
>
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to