Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Funkcja na emotikony
debian
post 22.11.2008, 22:42:36
Post #1





Grupa: Zarejestrowani
Postów: 122
Pomógł: 1
Dołączył: 6.11.2008
Skąd: /etc/passwd

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


Witam, proszę o pomoc przy stworzeniu funkcji która zamienia znaki tupu:
':)' na (images/1.gif)
':D' na (images/2.gif)
':>' (images/3.gif)
itd. No i proszę powiedzieć jak wyował tą funkcję gdzie wkleić itd. Pozdrawiam

Ten post edytował debian 22.11.2008, 22:46:53


--------------------
Go to the top of the page
+Quote Post
kwiateusz
post 22.11.2008, 23:17:02
Post #2


Admin Techniczny


Grupa: Administratorzy
Postów: 2 071
Pomógł: 93
Dołączył: 5.07.2005
Skąd: Olsztyn




str_replace" title="Zobacz w manualu PHP" target="_manual
Go to the top of the page
+Quote Post
marcio
post 22.11.2008, 23:17:19
Post #3





Grupa: Zarejestrowani
Postów: 2 291
Pomógł: 156
Dołączył: 23.09.2007
Skąd: ITALY-MILAN

Ostrzeżenie: (10%)
X----


Np:
  1. <?php
  2. function emotki($string) {
  3.  
  4. $emotikony =
  5. array(":[" => "emoty/zly.gif",
  6.  
  7. "**" => "emoty/star.gif",
  8. ":*"
  9. => "emoty/buzi.gif",
  10. ";(" =>
  11. "emoty/sad.gif",
  12. ""
  13. => "emoty/lol.gif",
  14.  ":P" =>
  15. "emoty/jezyk.gif",
  16.  "xD" =>
  17. "emoty/haha.gif",
  18.  ""
  19. => "emoty/zeby.gif",
  20.  ";]" =>
  21. "emoty/krzywy.gif",
  22. "=)" =>
  23. "emoty/happy.gif"[img]http://marcio.szu.pl/icon8.gif[/img];
  24.  
  25.  
  26.  
  27. foreach($emotikony as $tekst => $grafika) $string =
  28. str_replace($tekst,'<img src="'.$grafika.'"
  29.  
  30. />',$string);
  31.  
  32. return $string;
  33. }
  34. ?>


Ten post edytował marcio 22.11.2008, 23:17:34


--------------------
Zainteresowania: XML | PHP | MY(SQL)| C# for .NET | PYTHON
http://code.google.com/p/form-builider/
Moj blog
Go to the top of the page
+Quote Post
debian
post 23.11.2008, 10:42:15
Post #4





Grupa: Zarejestrowani
Postów: 122
Pomógł: 1
Dołączył: 6.11.2008
Skąd: /etc/passwd

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


Dziękuję smile.gif Ale jak to wywołać.
  1. <?php emotki($string); ?>
questionmark.gif


--------------------
Go to the top of the page
+Quote Post
marcio
post 23.11.2008, 10:47:45
Post #5





Grupa: Zarejestrowani
Postów: 2 291
Pomógł: 156
Dołączył: 23.09.2007
Skąd: ITALY-MILAN

Ostrzeżenie: (10%)
X----


  1. <?php
  2. $emota = emotki('tongue.gif');
  3. echo($emota);
  4. ?>


--------------------
Zainteresowania: XML | PHP | MY(SQL)| C# for .NET | PYTHON
http://code.google.com/p/form-builider/
Moj blog
Go to the top of the page
+Quote Post
debian
post 23.11.2008, 10:51:12
Post #6





Grupa: Zarejestrowani
Postów: 122
Pomógł: 1
Dołączył: 6.11.2008
Skąd: /etc/passwd

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


No ale hmmm bo to u mnie to jest taki jakby shoutbox. No i to jakoś muszę ulokować tam.


--------------------
Go to the top of the page
+Quote Post
marcio
post 23.11.2008, 10:56:53
Post #7





Grupa: Zarejestrowani
Postów: 2 291
Pomógł: 156
Dołączył: 23.09.2007
Skąd: ITALY-MILAN

Ostrzeżenie: (10%)
X----


OMG!! na zmienna pobierana z bazy ktora zawiera tresc wpisu wykonujesz funkcje emotki()


--------------------
Zainteresowania: XML | PHP | MY(SQL)| C# for .NET | PYTHON
http://code.google.com/p/form-builider/
Moj blog
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 Wersja Lo-Fi Aktualny czas: 28.06.2025 - 19:21