stew has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use CGI qw(param); use DBIx::FullTextSearch; use DBIx::FullTextSearch::StopList; use DBI; use HTML::Template; my $dbh = DBI->connect('dbi:mysql:xxxxx','xxxx','xxxxx'); my $search = param("search"); my $fts = DBIx::FullTextSearch->open($dbh, 'fts_cobra'); my @files = $fts->search($search); if (@files) { foreach $filename(@files){ $filename = substr($filename,0,-4); $sth = $dbh->prepare("SELECT id, title, summary FROM resource W +HERE id ='$filename'"); $sth->execute(); while ($ref = $sth->fetchrow_hashref()){ $title = $ref->{title}; $id = $ref->{id}; push @rows, { ID => $id, TITLE => $title }; } } } my $template = HTML::Template->new(filename => 'search.tmpl'); $template->param(TAB_BG_MAIN => "#0B5875"); $template->param(TAB_BG_HEAD => "#6180BA"); $template->param(SEARCH => $search); $template->param(ROWS => \@rows); print "Content-type: text/html\n\n"; print $template->output;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML::Template question
by broquaint (Abbot) on Nov 14, 2002 at 11:34 UTC | |
|
Re: HTML::Template question
by LTjake (Prior) on Nov 14, 2002 at 12:20 UTC | |
|
(jeffa) Re: HTML::Template question
by jeffa (Bishop) on Nov 14, 2002 at 17:56 UTC |