Thread Hilfe bei Website mit Perl/CGI/XML benötigt! (57 answers)
Opened by wusel81 at 2005-12-20 19:44

wusel81
 2006-01-29 21:29
#6404 #6404
User since
2005-12-20
27 Artikel
BenutzerIn
[default_avatar]
Also so langsam bekomm ich ein Problem... Ich MUSS das Donnerstag vorstellen.

Habe das Script jetzt voll runtergeschraubt um es zu testen.

die irland.cgi sieht nun so aus:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser); # Zeigt die Fehler an
use HTML::Template;

print "Content-type: text/html\r\n\r\n";
warningsToBrowser(1);


# Hier wird das Template geoeffnet
my $template = HTML::Template->new(filename => '/irland_mille.tmpl');


# Die Textdatei wird geoeffnet und an die Variable $text bzw. danach an TEXT uebergeben
open(TEXTDATEI, ">>", "/home.txt") or die "Can't open home.txt: $!";
my $text = join '', <TEXTDATEI>; # Der join Befehl liest alle Zeilen der Datei ein
close(TEXTDATEI);
$template->param(TEXT => $text); # evtl. use Encode::Entities; und encode_entities $text, denn $text kann HTML enthalten.


print $template->output();


Die irland_mille.tmpl sieht so aus:
Code: (dl )
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
42
43
44
45
46
47
<html>
<head>
<title>Irland </title>
<link rel="stylesheet" type="text/css" script type="text/javascript" href="style.css">
</head>

<body>
<div align="center"><br>
<br>
<table width="650" border="0">
<tr>
<td colspan="2"><div align="center"><img src="/images/header.jpg" alt="Header" width="650" height="168" /></div>
<div align="center"></div></td>
</tr>
<tr>
<td colspan="2"><div align="center"><img src="/images/navi.gif" alt="Navigation" width="650" height="23" border="0" usemap="#Map" /></div>
<div align="center"></div></td>
</tr>
<tr>
<td height="23"><div align="center"></div></td>
<td width="386"><div align="center">
</div></td>
</tr>
<tr>
<td width="260"><div align="center"><img src="/images/home.jpg" width="250" height="298" border="0" align="left" /></div></td>
<td rowspan="2" valign="top">
<!-- TMPL_VAR NAME=TEXT -->
</td>
</tr>
<tr>
<td><div align="center"><img src="/images/home_titel.gif" alt="Titel" width="250" height="69" align="left" /></div></td>
</tr>
<tr>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
</tr>
</table>
</div>
<map name="Map" id="Map"><br>
<area shape="rect" coords="26,3,93,20" href="" target="_self" alt="Home" />
<area shape="rect" coords="124,3,185,20" href="" target="_self" alt="Land" />
<area shape="rect" coords="218,3,350,20" href="" target="_self" alt="Geschichte" />
<area shape="rect" coords="382,3,504,20" href="" target="_self" alt="Menschen" />
<area shape="rect" coords="536,3,622,20" href="" target="_self" alt="Politik" />
</map>
</body>
</html>


Kann das bitte mal jemand bei sich ausprobieren ???
home.txt kann ja irgend nen text enthalten.

View full thread Hilfe bei Website mit Perl/CGI/XML benötigt!