Perl/MySQL/TT
Tony Bowden
tony at kasei.com
Mon Oct 29 08:26:30 CST 2001
On Mon, Oct 29, 2001 at 01:55:46PM +0000, Scott McWhirter wrote:
> >Can anyone give me a few pointers as to how to
> >get the data passed to the template in the right way?
>
> Here is a way i do it:
You are on drugs, aren't you.
Try:
package Person;
use strict;
use base 'Class::DBI::mysql';
__PACKAGE__->set_db('Main', 'dbi:mysql:dbname', 'username', 'password');
__PACKAGE__->set_up_table('table_name');
1;
package main;
use Template;
my @people = Person->search_like(name => 'Hugh %');
my $tt = Template->new;
$tt->process(\*DATA, { people => \@people } ) or die $tt->error;
__END__
[% FOREACH person = people %]
<p>[% name %]'s birthdate is [% dob %]
and this is what they look like: <img src="[% pic %]"></p>
[% END %]
Tony
--
--------------------------------------------------------------------------
Tony Bowden | tony at tmtm.com | http://www.tmtm.com/
si me asesinan, resucitare en el alma del pueblo
--------------------------------------------------------------------------
More information about the Belfast-pm
mailing list