login  Naam:   Wachtwoord: 
Registreer je!
 Forum

"rereplace"

Offline kurtkonijn - 15/12/2005 23:43
Avatar van kurtkonijnHTML interesse hoe kan ik normale htmlcodes weer omzetten naar ubb iemand enig idee?
Ik zou dus eigenlijk mijn adere script moeten "omdraaien" denk ik, maar hoe.
Dit is mijn replace script, zet dus ubb code om in html:
  1. <?
  2. function replace($text){
  3. $text = htmlspecialchars(stripslashes($text));
  4. $text = nl2br($text);
  5.  
  6.  
  7. $text = preg_replace("#\[b\](.*?)\[/b\]#si","<b>\\1</b>", $text);
  8. $text = preg_replace("#\[u\](.*?)\[/u\]#si","<u>\\1</u>", $text);
  9. $text = preg_replace("#\[i\](.*?)\[/i\]#si","<i>\\1</i>", $text);
  10. $text = preg_replace("#\[link\](.*?)\[/link\]#si","<a href=\"\\1\" target=\"_blank\">\\1</a>", $text);
  11. $text = preg_replace("#\[link=(.*?)\](.*?)\[/link\]#si","<a href=\"\\1\" target=\"_blank\">\\2</a>", $text);
  12. $text = preg_replace("#\[img\](.*?)\[/img\]#si","<img src=\"\\1\">", $text);
  13. $text = preg_replace("#\[color=(.*?)\](.*?)\[/color\]#si","<font color=\\1>\\2</font>", $text);
  14. $text = preg_replace("#\[move\](.*?)\[/move\]#si","<marquee>\\1</marquee>", $text);
  15. $text = preg_replace("#\[edit\](.*?)\[/edit\]#si","<font color=orange><b>Edit</b></font>: \\1", $text);
  16. $text = preg_replace("#\[quote\](.*?)\[/quote\]#si","<div style=\"margin-left:10px; padding-left:2px; border-left: 1px solid #666666\"><span class=\"opmerking\"><strong>Quote:</strong></span><br />\\1</div>", $text);
  17.  
  18. $sqles = mysql_query("SELECT * FROM `smileys`");
  19. while($for = mysql_fetch_object($sqles)){
  20. $text = str_replace($for->tag, "<img src=\"/_images/smileys/".$for->name.".gif\" alt=\"".$for->tag."\">", $text);
  21. }
  22.  
  23. return $text;
  24. }
  25.  
  26. $text = replace($msg);
  27.  
  28. ?>


iemand een idee?

0 antwoorden

Gesponsorde links
Er zijn nog geen reacties op dit bericht.
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.201s