|
Lines 211-219
sub GetNewsToDisplay {
Link Here
|
| 211 |
my $sth = $dbh->prepare($query); |
211 |
my $sth = $dbh->prepare($query); |
| 212 |
$lang = $lang // q{}; |
212 |
$lang = $lang // q{}; |
| 213 |
$sth->execute($lang,$branch); |
213 |
$sth->execute($lang,$branch); |
|
|
214 |
|
| 215 |
my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE}; |
| 216 |
my $template = Template->new( |
| 217 |
{ |
| 218 |
EVAL_PERL => 1, |
| 219 |
ABSOLUTE => 1, |
| 220 |
PLUGIN_BASE => 'Koha::Template::Plugin', |
| 221 |
COMPILE_EXT => $use_template_cache ? '.ttc' : '', |
| 222 |
COMPILE_DIR => $use_template_cache ? C4::Context->config('template_cache_dir') : '', |
| 223 |
FILTERS => {}, |
| 224 |
ENCODING => 'UTF-8', |
| 225 |
} |
| 226 |
) or die Template->error(); |
| 227 |
|
| 214 |
my @results; |
228 |
my @results; |
| 215 |
while ( my $row = $sth->fetchrow_hashref ){ |
229 |
while ( my $row = $sth->fetchrow_hashref ){ |
| 216 |
$row->{newdate} = output_pref({ dt => dt_from_string( $row->{newdate} ), dateonly => 1 }); |
230 |
$row->{newdate} = output_pref({ dt => dt_from_string( $row->{newdate} ), dateonly => 1 }); |
|
|
231 |
|
| 232 |
my $content = $row->{content}; |
| 233 |
my $output; |
| 234 |
$template->process( \$content, {}, \$output ) || croak "ERROR PROCESSING TEMPLATE: " . $template->error(); |
| 235 |
$row->{content} = $output; |
| 236 |
|
| 217 |
push @results, $row; |
237 |
push @results, $row; |
| 218 |
} |
238 |
} |
| 219 |
return \@results; |
239 |
return \@results; |
| 220 |
- |
|
|