Leser: 3
6 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[...]for ($i=0;$i<=$SIZE;$i++) {
$_=$LINES[$i];
if (/<!--begin-->/) {
if ($entry_order eq '1') {
print GUEST "<!--begin-->\n";
}
## Das hier habe ich eingefügt ##
$FORM{comments} = break_lines($FORM{comments});
if ($line_breaks == 1) {
$FORM{'comments'} =~ s/\cM\n/<br>\n/g;
}
print[...]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sub break_lines{
my $text = shift;
my $maxlength = 80;
my @commentlines = split(/\r?\n/,$text);
for my $line(@commentlines){
if(length($line) > $maxlength){
my $index = rindex($line,' ',$maxlength);
if($index != -1){
$line = substr($line,0,$index)."\n".substr($line,$index+1);
}
else{
$line = substr($line,0,$maxlength)."\n".substr($line,$maxlength+1);
}
}
}
$text = join("\n",@commentlines);
}
6 Einträge, 1 Seite |