TurboSasa Posted July 2, 2005 Report Share Posted July 2, 2005 lieta taada ka es gribu ielikt savaa gbook'aa smailinjus bet man nekas nesanaak. es meeginaaju shadi ka es skatos kas ir ievadiits un ja atrod kaut ko no shaa ":) :( :cry:", tad to tekstu aizvieto ar ziimeejumu, bet atduutos pret probleemu ja to smaidinju ir kaadi 22 tad tikai no tiem izvadaas 22, ja izdzeesh 22 tad izvadaas 21 (varbuut nesaprotami) , izvadaas tikai peedeejais kas ir tajaa sarakstaa? Link to comment Share on other sites More sharing options...
bubu Posted July 2, 2005 Report Share Posted July 2, 2005 99.99% ka vaina tavā kodā :) Link to comment Share on other sites More sharing options...
TurboSasa Posted July 2, 2005 Author Report Share Posted July 2, 2005 $txt = \"es ir labais :)\"; $smile_txt = \":)\"; $smile_gif = \"\"; $smile_txt = str_replace($smile_txt, $smile_gif, $txt); es izmantoju shadu kodu, un taa katram smaidinjam.... to ":)" aizvietoju ar kaut vai ":(" un taa atkaartojos cik man to smaidinju ir (manaa gadijumaa 22) ... Link to comment Share on other sites More sharing options...
bubu Posted July 2, 2005 Report Share Posted July 2, 2005 Nu šis koda fragments, ja izvāc tos visus \, ir pareizs. Vaina ir citā koda daļā noteikti. Link to comment Share on other sites More sharing options...
TurboSasa Posted July 2, 2005 Author Report Share Posted July 2, 2005 zinu par tiem / bet vari pats pameeginaat ielikt kaadus taadus kodus piem piecus gabalus ar dazhaadeim zimeejumiem un aizvietijamiem simboliem tev izvadiis tikai piekto bet pirmos chatrus izvadiis kaa pliku tekstu(man vismaz ir taa), nezinu kur ir probleema.... :unsure: Link to comment Share on other sites More sharing options...
bubu Posted July 2, 2005 Report Share Posted July 2, 2005 (edited) Saderam, ka man viss strādās :D Edited: lūdzu, un tā var turpināt tos masīvus ilgi :) <?php $text = 'abc :);) :D :-);-) :O) :P;P'; $smileys_in = array(':)', ';)', ':D', ':-)', ';-)', ':O)', ':P', ';P'); $smileys_out = array( '<img src="smiley1.png"/>', '<img src="smiley2.png"/>', '<img src="smiley3.png"/>', '<img src="smiley4.png"/>', '<img src="smiley5.png"/>', '<img src="smiley6.png"/>', '<img src="smiley7.png"/>', '<img src="smiley8.png"/>'); echo str_replace($smileys_in, $smileys_out, $text); ?> Ārā iznāk: abc <img src="smiley1.png"/> <img src="smiley2.png"/> <img src="smiley3.png"/> <img src="smiley4.png"/> <img src="smiley5.png"/> <img src="smiley6.png"/> <img src="smiley7.png"/> <img src="smiley8.png"/> Edited July 2, 2005 by bubu Link to comment Share on other sites More sharing options...
TurboSasa Posted July 2, 2005 Author Report Share Posted July 2, 2005 pameeginaashu, bet pirmaa masiiva pirmais elements atbilst otraa masiiva pirmajam elementam? , un kas notiek ja tie masiivi nav vienaada lieluma? Link to comment Share on other sites More sharing options...
bubu Posted July 2, 2005 Report Share Posted July 2, 2005 (edited) A šeit: http://lv.php.net/manual/en/function.str-replace.php nav jāskatās? <_< Uz pirmo jautājumu atbilde - jā, uz otro - aizvietos ar tukšu stringu. Edited July 2, 2005 by bubu Link to comment Share on other sites More sharing options...
php_Stopp Posted July 4, 2005 Report Share Posted July 4, 2005 peec idejas vareetu buut saadi: $text = $_POST['text']; $text = str_replace ( ':)', '<img src="img/smile_01.gif">', $text ); un taa katru smailiju; man viss darbojas :) Link to comment Share on other sites More sharing options...
rudzis Posted July 4, 2005 Report Share Posted July 4, 2005 Jap, es arī, taisot kaut ko saistītu ar smailiem, lietoju to pašu principu, ko jau paraadiija bubu un php_Stopp, un nav bijis probleemu :) Link to comment Share on other sites More sharing options...
php_Stopp Posted July 4, 2005 Report Share Posted July 4, 2005 (edited) nuu jaa, patiesiibaa jau bubu paraadiija to pasu; es tik mazliet sarezgiitaak :D edit: nu.. bisku cakariigaak, ne sarezgiitaak Edited July 4, 2005 by php_Stopp Link to comment Share on other sites More sharing options...
php_Stopp Posted July 4, 2005 Report Share Posted July 4, 2005 pameeginaashu, bet pirmaa masiiva pirmais elements atbilst otraa masiiva pirmajam elementam? , un kas notiek ja tie masiivi nav vienaada lieluma? 18966[/snapback] tos masiivus jau raksti tu pats; buutu stulbi rakstiit nevienaada lieluma :D Link to comment Share on other sites More sharing options...
v3rb0 Posted July 5, 2005 Report Share Posted July 5, 2005 (edited) .. Edited July 5, 2005 by v3rb0 Link to comment Share on other sites More sharing options...
php_Stopp Posted July 8, 2005 Report Share Posted July 8, 2005 $txt = \"es ir labais :)\";$smile_txt = \":)\"; $smile_gif = \"\"; $smile_txt = str_replace($smile_txt, $smile_gif, $txt); es izmantoju shadu kodu, un taa katram smaidinjam.... to ":)" aizvietoju ar kaut vai ":(" un taa atkaartojos cik man to smaidinju ir (manaa gadijumaa 22) ... 18962[/snapback] zinu par tiem / bet vari pats pameeginaat ielikt kaadus taadus kodus piem piecus gabalus ar dazhaadeim zimeejumiem un aizvietijamiem simboliem tev izvadiis tikai piekto bet pirmos chatrus izvadiis kaa pliku tekstu(man vismaz ir taa), nezinu kur ir probleema.... :unsure: 18964[/snapback] laikam nojausu, kaapeec paarveidoja tikai peedeejo. tu gadiijumaa nerakstiiji saadu kodu: $smile_txt = ":)"; $smile_gif = "<img src="smile1.gif"/>"; $smile_txt = ";)"; $smile_gif = "<img src="smile2.gif"/>"; $text = str_replace ( $smile_txt, $smile_gif, $text ); vai arii: $smile_txt = ":)"; $smile_gif = "<img src="smile1.gif"/>"; $text = str_replace ( $smile_txt, $smile_gif, $text ); $smile_txt = ";)"; $smile_gif = "<img src="smile2.gif"/>"; $text = str_replace ( $smile_txt, $smile_gif, $text ); ? ja taa, tad tiiri logiski, ka tikai peedeejo paarveido.. bet nu tas taa, starp citu :P Link to comment Share on other sites More sharing options...
bubu Posted July 8, 2005 Report Share Posted July 8, 2005 Otrais variants gan ir pareizs. Link to comment Share on other sites More sharing options...
Recommended Posts