Browse Source

Adding more variables for RSS 2.0 template, altering date format for RSS 2.0 compatibility

3.0.x
oleonard 20 years ago
parent
commit
94b31fb3c8
  1. 19
      rss/rss.pl

19
rss/rss.pl

@ -1,4 +1,4 @@
#!/usr/bin/perl -w #!/usr/bin/perl
# This script can be used to generate rss 0.91 files for syndication. # This script can be used to generate rss 0.91 files for syndication.
@ -30,7 +30,9 @@ use strict;
use HTML::Template; use HTML::Template;
use C4::Context; use C4::Context;
use Time::Local; use Time::Local;
use POSIX;
my $dbh = C4::Context->dbh;
my $file = $ARGV[0]; my $file = $ARGV[0];
my %config = getConf("config"); my %config = getConf("config");
my $outFile = $config{"output"}; my $outFile = $config{"output"};
@ -47,6 +49,9 @@ my %image = getConf("image");
$feed->param(IMAGETITLE => $image{'title'}); $feed->param(IMAGETITLE => $image{'title'});
$feed->param(IMAGEURL => $image{'url'}); $feed->param(IMAGEURL => $image{'url'});
$feed->param(IMAGELINK => $image{'link'}); $feed->param(IMAGELINK => $image{'link'});
$feed->param(IMAGEDESCRIPTION => $image{'description'});
$feed->param(IMAGEWIDTH => $image{'width'});
$feed->param(IMAGEHEIGHT => $image{'height'});
# #
# handle the items # handle the items
@ -58,7 +63,8 @@ print FILE $feed->output();
close FILE; close FILE;
sub getDate { sub getDate {
my $date = localtime(timelocal(localtime)); # my $date = localtime(timelocal(localtime));
my $date = strftime("%a, %d %b %Y %T %Z", localtime);
return $date; return $date;
} }
@ -87,7 +93,6 @@ sub getConf {
sub getItems { sub getItems {
my $query = shift; my $query = shift;
$query .= " limit 15"; $query .= " limit 15";
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare($query); my $sth=$dbh->prepare($query);
$sth->execute; $sth->execute;
my @return; my @return;
@ -100,10 +105,4 @@ sub getItems {
} }
$sth->finish; $sth->finish;
return \@return; return \@return;
} }
Loading…
Cancel
Save