[php] ubb codes en meer (newbie)

Pagina: 1
Acties:
  • 74 views sinds 30-01-2008

  • smaij
  • Registratie: November 2000
  • Laatst online: 22:56
Ik heb een gastenboek met smilies geschreven.. nu zou ik daar ook tags in willen gebruiken die door de replace functies worden omgezet.. Ik heb search van got gebruikt, heb veel andere sites gecheckt en code "getest" van Vbulletin. nu wil dit dus allemaal niet werken..
mijn laatste werkte helemaal niet, toen ik trachte te proberen van alle functie 1 overzichtelijke functie te maken..
Kan iemand mij helpen?
PHP:
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
<?
 <?php
function MakeUbb($string){
 $string = nl2br($string);
 $string = str_replace(" X( ","[img]angry.gif[/img]",$string);
 $string = eregi_replace(" :f ","[img]flirt.gif[/img]",$string);
 $string = eregi_replace(" :x ","[img]dead.gif[/img]",$string);
 $string = str_replace(" :( ","[img]frown.gif[/img]",$string);
 $string = eregi_replace(" :h ","[img]cool.gif[/img]",$string);
 $string = eregi_replace(" :i ","[img]idea.gif[/img]",$string);
 $string = str_replace(" :) ","[img]smile.gif[/img]",$string);
 $string = str_replace(" ;) ","[img]wink.gif[/img]",$string);
 $string = str_replace(" :l ","[img]hrmpf.gif[/img]",$string);
 $string = eregi_replace(" :o ","[img]redface.gif[/img]",$string);
 $string = str_replace(" :00 ","[img]look.gif[/img]",$string);
 $string = eregi_replace(" :p ","[img]tounge.gif[/img]",$string);
 $string = eregi_replace(" :q ","[img]quest.gif[/img]",$string);
 $string = eregi_replace(" :r ","[img]shame.gif[/img]",$string);
 $string = eregi_replace(" :D ","[img]biggrin.gif[/img]",$string);
 $string = eregi_replace(" :e ","[img]supergrin.gif[/img]",$string); 
 $string = eregi_replace(quotemeta("[b]"),quotemeta("<b>"),$string);
 $string = eregi_replace(quotemeta("[/b]"),quotemeta("</b>"),$string);
 $string = eregi_replace(quotemeta("[i]"),quotemeta("<i>"),$string);
 $string = eregi_replace(quotemeta("[/i]"),quotemeta("</i>"),$string);
 $string = eregi_replace(quotemeta("[u]"),quotemeta("<u>"),$string);
 $string = eregi_replace(quotemeta("[/u]"),quotemeta("</u>"),$string);
 $string = eregi_replace("\\\[url\\]www.([^\\\[]*)\\\[/url\\]","<a href=\"http://www.\\1\" target=_blank>\\1</a>",$string);
 $string = eregi_replace("\\\[url\\]([^\\\[]*)\\\[/url\\]","<a href=\"\\1\" target=_blank>\\1</a>",$string);
 $string = eregi_replace("\\\[email\\]([^\\\[]*)\\\[/email\\]","<a href=\"mailto:\\1\">\\1</a>",$string);
 $string = eregi_replace("quote\\]","quote]",$bbcode);  // make lower case
 $string = str_replace("[quote]\r\n","<blockquote><smallfont>quote:</smallfont><hr>",$string);
 $string = str_replace("[quote]","<blockquote><smallfont>quote:</smallfont><hr>",$string);
 $string = str_replace("[/quote]\r\n","[/quote]",$string);
 $string = str_replace("[/quote]","[/quote]",$string);
 $string = eregi_replace("\\\[img\\]([^\"\\\[]*)\\\[/img\\]","[img]\"\\1\"[/img]",$string);
 return $string;
}
?>

de fout die dan ontstaat is dat $string aan het eind dus leeg is :?

o ja.. als laatste: dit topic [topic=83916/2/25] heb ik gebruikt en de verwijzingen die daarin staan ook allemaal

  • Arjan A
  • Registratie: November 2000
  • Laatst online: 09:35

Arjan A

Cenosillicafoob

Bijna onderaan (te lui om te tellen):
code:
1
$string = eregi_replace("quote\\]","quote]",$bbcode);  // make lower case

$bbcode ff replacen door $string

Canon EOS | DJI M2P
Fotoblog · Mijn werk aan jouw muur


Verwijderd

Op zondag 20 januari 2002 00:01 schreef Arjan_A het volgende:
Bijna onderaan (te lui om te tellen):
code:
1
$string = eregi_replace("quote\\]","quote]",$bbcode);  // make lower case

$bbcode ff replacen door $string
Inderdaad.

Daar kan je toch wel zo'n heel klein beetje veel zelf op komen, niet?

  • wasigh
  • Registratie: Januari 2001
  • Niet online

wasigh

wasigh.blogspot.com

volgende keer iets beter zoeken

Dit topic is gesloten.