Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> gdzie jest bład, Parse error: parse error in...
klekot
post
Post #1





Grupa: Zarejestrowani
Postów: 78
Pomógł: 0
Dołączył: 16.08.2005

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


Mam sobie taki kod
  1. <?php
  2. function pscode($string){
  3. //formatowanie
  4. $string = preg_replace("'(.*)'si","<b>1</b>", $string);
  5. $string = preg_replace("'(.*)'si","<i>1</i>", $string);
  6. $string = preg_replace("'(.*)'si","<u>1</u>", $string);
  7. $string = preg_replace("'
    (.*)
    'si"
    ,"<center>1</center>", $string);
  8. $string = preg_replace("'*)](.*)'si", "<font color="1">2</font>",$string);
  9. //obrazek 
  10. $string = preg_replace("'[img]([0-9a-zA-Z~`!@#$%^&-_=+|/:;]*)[/img]'si","<img src="1" border=0>", $string);
  11. //url'e
  12. $string = preg_replace("'([a-zA-Z0-9-_.]*)'si","<a href="http://1" target="_blank">1</a>", $string);
  13. $string = preg_replace("'([a-zA-Z]*://[a-zA-Z0-9._-]*)'si","<a href="1" target="_blank">1</a>", $string);
  14. $string = preg_replace("'([a-zA-Z._-]*[@]{1}[a-zA-Z0-9.-_]*){1}'si","<a href="mailto:1">1</a>", $string);
  15. $string = preg_replace("'*[@]{1}[a-zA-Z0-9.-_]*)]([a-zA-Z0-9.]*)'si", "<a href="mailto:1">2</a>", $string);
  16. $string = preg_replace("'*)]([a-zA-Z0-9.]*).'si", "<a href="http://1" target="_blank">2</a>", $string);
  17. $string = preg_replace("'*://[a-zA-Z0-9.]*)]([a-zA-Z0-9.]*)'si", "<a href="1" target="_blank">2</a>", $string);
  18.  
  19. //na wypadek, gdyby za wcześnie ucięło string'a
  20. $string = preg_replace("'[b](.*)'si","<b>1</b>", $string);
  21. $string = preg_replace("'[i](.*)'si","<i>1</i>", $string);
  22. $string = preg_replace("'[u](.*)'si","<u>1</u>", $string);
  23. $string = preg_replace("'[center](.*)'si","<center>1</center>", $string);
  24. $string = preg_replace("'[img]([0-9a-zA-Z~`!@#$%^&-_=+|/:;]*)'si","<img src="1" border=0>", $string);
  25. $string = preg_re");
  26. }place("'[color=([a-zA-Z1-9#(),]*)](.*)'si", "<font color="1">2</font>",$string);
  27. // To jest linia 173, tu jest pusto i nie ma tu zadnego kodu
  28.  
  29. return("$string");
  30. }
  31. ?>
i w miejscu icludowania pliku ktory czyta newsy (show.php), wyskakuje mi taki bład: Parse error: parse error in c:\usr\apache\httpd\html\n\a\functions.php on line 173
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
Cienki1980
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 1 590
Pomógł: 40
Dołączył: 11.01.2007
Skąd: Centrum

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


widać jak na dłoni, że rozdzieliłeś nazwę funkcji, wstawione są jakieś znaczki, klamry itp.

  1. <?php
  2. $string = preg_replace("'[color=([a-zA-Z1-9#(),]*)](.*)'si", "<font color="1">2</font>",$string);
  3. ?>


Różnice chyba widać na pierwszy rzut oka.


--------------------
404
Go to the top of the page
+Quote Post
klekot
post
Post #3





Grupa: Zarejestrowani
Postów: 78
Pomógł: 0
Dołączył: 16.08.2005

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


kto widzi ten widzi, ale chyba nie wszyscy sad.gif Mozesz poprawic? Dostalem od kolegi ten skrypt, a ja teraz nie mam z nim kontaktu bo wyjechał do niemiec.

Ten post edytował klekot 23.01.2007, 22:28:14
Go to the top of the page
+Quote Post
Balas
post
Post #4





Grupa: Zarejestrowani
Postów: 347
Pomógł: 0
Dołączył: 27.08.2005
Skąd: Inowrocław

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


popatrz na kolorowanie skladni:
  1. <?php
  2.  $string = preg_re");
  3. }place("'[color=([a-zA-Z1-9#(),]*)](.*)'si", "<font color="1">2</font>",$string);
  4. ?>

zmien na

  1. <?php
  2.  $string = preg_replace("'[color=([a-zA-Z1-9#(),]*)](.*)'si", "<font color="1">2</font>",$string);
  3. ?>


edit. sory za brak tagow ale sie psuje winksmiley.jpg
edit2. @maryaan, oka thx winksmiley.jpg

Ten post edytował Balas 24.01.2007, 12:12:09


--------------------
Go to the top of the page
+Quote Post
maryaan
post
Post #5





Grupa: Zarejestrowani
Postów: 380
Pomógł: 2
Dołączył: 5.01.2007

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


Cytat(klekot @ 23.01.2007, 20:34:21 ) *
Dostalem od kolegi ten skrypt, a ja teraz nie mam z nim kontaktu bo wyjechał do niemiec.
L O L czy Twoj dziadek nie nazywal sie Brzechwa? zerznales ta funkcje z ktorejs wersji psnews, nawet nie zmieniles nazwy ani komentarzy laugh.gif
Cytat(Balas @ 24.01.2007, 00:38:16 ) *
edit. sory za brak tagow ale sie psuje winksmiley.jpg
nie psuje sie, jak po wyslaniu masz burdel z ukosnikami to sobie odswiez strone winksmiley.jpg
  1. <?php
  2. $string = preg_replace("'[color=([a-zA-Z1-9#(),]*)](.*)'si", "<font color="1">2</font>",$string);
  3. ?>


--------------------
Wybierasz się do Zakopanego? Odwiedź Willę Pod Górami. Następnym razem na pewno do niej wrócisz :)
Go to the top of the page
+Quote Post
klekot
post
Post #6





Grupa: Zarejestrowani
Postów: 78
Pomógł: 0
Dołączył: 16.08.2005

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


Cytat(maryaan @ 24.01.2007, 04:07:14 ) *
L O L czy Twoj dziadek nie nazywal sie Brzechwa? zerznales ta funkcje z ktorejs wersji psnews, nawet nie zmieniles nazwy ani komentarzy laugh.gif
a czy ja mowilem ze to jest moj projekt i ja go sam napisalem? Mowilem ze wziolem od kolegi, a nie wnikalem w to skad go ma.
a czy ja mowilem ze to jest moj projekt i ja go sam napisalem? Mowilem ze wziolem od kolegi, a nie wnikalem w to skad go ma.
Aha i dzieki za pomoc

Ten post edytował klekot 24.01.2007, 16:43:50
Go to the top of the page
+Quote Post

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 - 16:09