xNeTworKx: Und wie stehts mit einem Forum?

Beitrag lesen

Hallo,

Ich arbeite zwar mit Perl, aber vielleicht kannst du dir aus meiner Subrountine etwas ableiten :

sub changeintohtml   {
my $text = shift;
  $$text =~ s/</</g;
  $$text =~ s/>/>/g;
  $$text =~ s/\n/<br>/g;
  $$text =~ s/"/"/g;
  $$text =~ s/(\s\s+)/(' ' x (length($1)-1)) . ' '/eg;

while ($$text =~ /[s(\d\d?)]/g)   {
  my $tag = "<img src="pics/smiley$1.gif" alt="">";
  $$text =~ s/[s\d\d?]/$tag/;
  }

while ($$text =~ /[image](.+?)[/image]/g)   {
  my $tag = "<img src="$1" alt="">";
  $$text =~ s/[image].+?[/image]/$tag/;
  }
  while ($$text =~ /[link](.+?)[/link]/g)   {
  my $tag = "<a href="$1">$1</a>";
  $$text =~ s/[link].+?[/link]/$tag/;
  }
  while ($$text =~ /[flash=(\d{1,4}),(\d{1,4}),version=(\d)](.+?)[/flash]/g)   {
  my $tag = "<object classid="CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=$3,0,0,0" width="$1" height="$2">
             <param name="movie" value="$4">
             <param name="quality" value="high">
             <param name="scale" value="exactfit">
             <param name="menu" value="true">
             <p>Sorry, dein Browser kann das Flash Movie nicht anzeigen.</p>
             </object>";
  $$text =~ s/[flash=\d{1,4},\d{1,4},version=\d].+?[/flash]/$tag/;
  }
}