Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> BBcode, chyba banalny problem
k0b3
post
Post #1





Grupa: Zarejestrowani
Postów: 138
Pomógł: 0
Dołączył: 1.08.2006
Skąd: Kielce

Ostrzeżenie: (0%)
-----


Przeszukiwałem to forum oraz inne i mam problem z bbcode w newsach.. wszedzie jest prawie identyczny kod, ale nie wiem jak go uzyc!

Tu mam kod, zapożyczony od jednego z userów:

  1. <?php
  2.  
  3.  
  4.  
  5. function bbcodetohtml($text) {
  6. $text = strip_tags($text);
  7. $text = nl2br($text);
  8.  
  9. $text = str_replace("","<b>", $text);
  10. $text = str_replace("","</b>", $text);
  11. $text = str_replace("","<i>", $text);
  12. $text = str_replace("","</i>", $text);
  13. $text = str_replace("","<u>", $text);
  14. $text = str_replace("","</u>", $text);
  15. $text = str_replace("
    ","<center>", $text);
  16. $text = str_replace("
    ","</center>", $text);
  •  
  • $text = str_replace("[aragorn]","<img src=images/emot/arag.gif title=Aragorn>", $text);
  • $text = str_replace("[boromir]","<img src=images/emot/boro.gif title=Boromir>", $text);
  • $text = str_replace("[gandalf]","<img src=images/emot/gand.gif title=Gandalf>", $text);
  • $text = str_replace("[gimli]","<img src=images/emot/gim.gif title=Gimli>", $text);
  • $text = str_replace("[legolas]","<img src=images/emot/lego.gif title=Legolas>", $text);
  • $text = str_replace("[saruman]","<img src=images/emot/saru.gif title=Saruman>", $text);
  •  
  • return $text;
  • }
  •  
  •  
  • ?>


  • zdaje mi sie to banalne, ale naprawdę nie wiem jak zrobic zeby działał ten kod

    wpisuje np:

    echo '[ b] dasdsadsa [ /b]'; (oczywiscie bez spacji) i wychodzi mi na stronie [ b] dasdsadsa [ /b]

    jak mam to uzyc.. sadsmiley02.gif ?
    z góry dzięki za pomoc
    Go to the top of the page
    +Quote Post

    Posty w temacie


    Reply to this topicStart new topic
    1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
    0 Zarejestrowanych:

     



    RSS Aktualny czas: 20.08.2025 - 09:49