smarty Posted May 26, 2005 Report Posted May 26, 2005 vai kaadam ir aizkjeeries skripts, kas tekstaa linkus paarveido par spiezhamu prieku, samazinot to garumu (taa, lai tos nesabojaatu visam tekstam uzlaizhot wordwrap), ljoti nodereetu
bubu Posted May 26, 2005 Report Posted May 26, 2005 http://hackers.lv/?mid=cat&upcat=40&id=538 Atliek tik pielikt callback funkciju, kas samazina teksta garumu, ta tas par garu.
smarty Posted May 26, 2005 Author Report Posted May 26, 2005 taa diivaini, tik daudz materiaalu inetaa par php, bet shiis lietas nav (vismaz nevaru atrast)
leisure Posted May 26, 2005 Report Posted May 26, 2005 iisteniibaa ir gan, sho te ar kaadiem vairaakiem variantiem atradu mieriigi... var jau arii pachekot kaadu OpenSourci...
smarty Posted May 26, 2005 Author Report Posted May 26, 2005 nu kaa, ja es uzrakstu function find_res($text) { $patt='/(http(s?):\/\/|ftp:\/\/)([^\/]*)([^ ]*)/i'; return preg_replace_callback($patt, 'wrapurl', htmlspecialchars($text)); } function wrapurl($matches) { return '<a href="'.$matches[1].$matches[3].$matches[4].'">'.$matches[3].'</a>'; } bet peec tam tekstu wrapoju $txt = find_res($txt);$txt = ereg_replace("([^ ]{60})","\\1<br />", $txt); tad tas urlis shaa vai taa tiek sabojaats
smarty Posted May 26, 2005 Author Report Posted May 26, 2005 (edited) jaa viss jau buutu labi, ja man nevajadzeetu wrapot textu!! respektiivi, ja teksts ir sdfs sgd fgdfg http://www.google.lv/search?hl=lv&q=baigi+...%C5%A1ana&meta=sdfsdfsf s gsdg tad rezultaats ir sdfs sgd fgdfg <a class="clink" href="http://www.google.lv/search?hl=lv&q=baigi+labais+skrip<br />ts&btnG=Google+mekl%C4%93%C5%A1ana&meta=" target="_blank">http://www.google.lv/search?hl=lv&q=baig&hel<br />lip;</a>sdfsdfsf s gsdg (pa vidu ir atstarpe linkaa) Edited May 26, 2005 by smarty
bubu Posted May 26, 2005 Report Posted May 26, 2005 Tak netaisi savu ereg_replace("([^ ]{60})","\\1<br />", $txt); pēc tās fjas izsaukšanas, bet gan IEKŠĀ tai wrapurl funkcijā.
smarty Posted May 26, 2005 Author Report Posted May 26, 2005 taa wraposhana tiek taisiita visam tekstam!! funkcija wrapurl nesanjem pashu tekstu, tikai izkasiito urli
Recommended Posts