Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> preg replace i zamiana na funkcje
1010
post
Post #1





Grupa: Zarejestrowani
Postów: 749
Pomógł: 37
Dołączył: 3.10.2006

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


Witam,
mam taki kod:
  1. <?
  2. $newtext = eregi_replace("{YOUTUBE}(.*){/YOUTUBE}", "1", $newtext);
  3. ?>

zamienia ona coś takiego
Kod
hfud ishu ihfds hfuis huif {YOUTUBE}tutaj link{/YOUTUBE} fhus hfui h

na
Kod
hfud ishu ihfds hfuis huif tutaj link fhus hfui h



Natomiast gdy chcę zrobić takie cos:
  1. <?
  2. $newtext = eregi_replace("{YOUTUBE}(.*){/YOUTUBE}", youtube("1"), $newtext);
  3. ?>

moim celem jest aby w miejsce {YOUTUBE}tutaj link{/YOUTUBE} funkcja zrobiła z linku object. Jednak gdy w funkcji wyświetle parametr który przekazuje to wyświetla \1. Dlaczego nie przekazuje linku?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
1010
post
Post #2





Grupa: Zarejestrowani
Postów: 749
Pomógł: 37
Dołączył: 3.10.2006

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


niestety taka linia:

  1. <? $newtext = preg_replace_callback("{YOUTUBE}(.*){/YOUTUBE}", "youtube", $newtext); ?>


zwraca mi taki błąd:
Kod
Warning: preg_replace_callback() [function.preg-replace-callback]: Delimiter must not be alphanumeric or backslash in C:\Documents and Settings\Administrator\Desktop\www\flyweb\butelka\funkcje\bbcode.php on line 68
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 4.10.2025 - 23:24