From 00cd26abf2b1d891211046b95005e791912910ae Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 18 Feb 2005 13:35:19 +0000 Subject: [PATCH] Add a backend for showing songs and the best scores on them. --- html/song.pl | 20 ++++++++++++++++++++ html/templates/song.tmpl | 30 ++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100755 html/song.pl create mode 100644 html/templates/song.tmpl diff --git a/html/song.pl b/html/song.pl new file mode 100755 index 0000000..1b1be39 --- /dev/null +++ b/html/song.pl @@ -0,0 +1,20 @@ +#! /usr/bin/perl + +use ccbs; +use strict; +use warnings; + +my $cgi = new CGI; +my $id = $cgi->param('id'); + +my $dbh = ccbs::db_connect(); + +my $song = $dbh->selectrow_hashref('SELECT * FROM songs WHERE song=?', undef, $id); +my $scores = ccbs::db_fetch_all($dbh, 'SELECT * FROM scores NATURAL JOIN players NATURAL JOIN tournaments WHERE song=? ORDER BY score DESC', $id); + +ccbs::print_header(); +ccbs::process_template('song.tmpl', $song->{'title'}, { + song => $song, + scores => $scores +}); +$dbh->disconnect; diff --git a/html/templates/song.tmpl b/html/templates/song.tmpl new file mode 100644 index 0000000..5de46c0 --- /dev/null +++ b/html/templates/song.tmpl @@ -0,0 +1,30 @@ +[%# vim:set filetype=html: %] +

Generelle fakta

+ +
+ +
+ +

Beste scores

+ +
+ + + + + + + +[% FOR s = scores %] + + + + + +[% END %] +
SpillerPoengsumArrangement
[% s.nick %][% s.score %][% s.tournamentname %]
+
-- 2.39.2