Re: Data -> template (brain -> Perl)
Brad Baxter <[email protected]> Fri, 11 Sep 2009 11:12:57 -0400
| Newsgroups | gmane.comp.lang.perl.modules.html-template |
|---|---|
| Message-ID | <[email protected]> |
Bob, You need to 'return' the data rather than 'print'ing it. Brad On Fri, Sep 11, 2009 at 11:06 AM, Robert <[email protected]> wrote: > I am using XML::Simple to get some "simple" XML data. > > $template->param( DATA =3D> sub { > =A0 =A0 =A0 =A0for my $list ( @{ $data->{list} } ) { > =A0 =A0 =A0 =A0 =A0 =A0print "<p>$list->{name}[0]</p><p>$list->{descripti= on}[0]</p>"; > =A0 =A0 =A0 =A0} > =A0 =A0} > ); > > That prints the data to the template at the top...it doesn't go into the > DATA var. Do I need to do the for loop outside of the $template-param? > > Bob > > > -------------------------------------------------------------------------= ----- > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-D= ay > trial. Simplify your report design, integration and deployment - and focu= s on > what you do best, core application coding. Discover what's new with > Crystal Reports now. =A0http://p.sf.net/sfu/bobj-july > _______________________________________________ > Html-template-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/html-template-users > -- = Brad Baxter ---------------------------------------------------------------------- ---------------------------------------------------------------------------= --- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day = trial. Simplify your report design, integration and deployment - and focus = on = what you do best, core application coding. Discover what's new with = Crystal Reports now. http://p.sf.net/sfu/bobj-july