Leser: 1
9 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@Keys = sort_keys(@Keys);
foreach my $key (@Keys) {
open FILE, "$DIR/$key" or die "Can't open $DIR/$key: $!\n";
$Text .= "<h4>$DATA{$key}{subject}</h4>\n";
$Text .= "<b>$DATA{$key}{von}</b>\n";
$DATA{$key}{bis} and ($Text .= " <b>$DATA{$key}{bis}</b>\n");
$Text .= '<p>';
while (<FILE>) {
$Text .= $_;
}
($DATA{$key}{link}) and
($Text .= "<br><br><b><a href=\"$DATA{$key}{link}\">... weiter lesen</a></b>");
$Text .= "</p>\n<hr size=\"1\" width=\"80%\">\n";
}
$$CONFIG{actdata} = $Text;
my $T = Template->new({
INCLUDE_PATH => $$CONFIG{templatedir},
POST_CHOMP => 1,
});
print "Content-Type: text/html; charset=$$CONFIG{charset}
";
$T->process('aktuell.html', $CONFIG) || die $T->error();
# Keys nach Datum (von) sortieren:
sub sort_keys {
my (%sort, $sdate, @tmp);
my $i = 0;
foreach my $key (@_) {
$i++;
@tmp = split /\./, $DATA{$key}{von};
$sdate = "$tmp[-2]$tmp[-1]$tmp[0]";
$sort{"$sdate$i"} = $key;
}
@sort{sort keys %sort};
}
1
2
3
4
@array = map { $_->[0] } sort { $a->[3] <=> $b->[3] ||
$a->[2] <=> $b->[2] ||
$a->[1] <=> $b->[1] }
map { [$_, split /\./] } @array;
$sdate = "$tmp[-2]$tmp[-1]$tmp[0]";
$sdate = "$tmp[2]$tmp[1]$tmp[0]";
1
2
3
4
5
6
7
8
9
10
11
sub sort_keys {
my %sort;
my $i = 0;
my $d;
foreach (@_) {
$i++;
$d=$DATA{$_}{von};
$sort{substr($d,6,4).substr($d,3,2).substr($d,0,2).$i} = $_;
}
return @sort{sort keys %sort};
}
9 Einträge, 1 Seite |