andrisp Posted September 1, 2005 Report Share Posted September 1, 2005 (edited) kaadam nav aizkjeeries skriptinjs, kas paaraak garus vaardus sagriezh, bet linkus ieliek starp <a></a> un vizuaali saiisina bet nesagriezh - tipa http://www.example.com/asdasd/asdsad.php paraadiitos kaa www.example.com uz kuru var nospiest.. $txt = preg_replace("/.\S{20}/",'${0} ',$txt); ar shito es griezhu vaardus.. Edited September 1, 2005 by andrisp Link to comment Share on other sites More sharing options...
eglitis Posted September 1, 2005 Report Share Posted September 1, 2005 http://www.cerdmann.com/linkurl/ - smarty plugins, bet pa pusei atbilst tavām prasībām, domāju ka pārrakstīt tev vajadzīgajā formā problēmas neradīsies. Link to comment Share on other sites More sharing options...
andrisp Posted September 2, 2005 Author Report Share Posted September 2, 2005 preg_replace("/((http|ftp)+(s)?:(\/\/)([\w]+(.[\w]+))([\w\-\.,@?^=%&:;\/~\+#]*[\w\-\@?^=%&:;\/~\+#])?)/i", "<a href=\"\\0\">[ saite ]</a>", $text); atradu shitaadu, kas paarveido linkus, bet kaa lai uztaisa, lai vinjs starp <a></a> ieliktu , piemeeram, pirmos 15 simbolus no linka ? Link to comment Share on other sites More sharing options...
Delfins Posted September 2, 2005 Report Share Posted September 2, 2005 (edited) tā jau tev nav nekāda apgrizīšana, bet URL meklēšana tekstā... function url_replacer( $arr ) { return '<a href="'.$arr[0].'">'.substr( $arr[0], 0, 15 ) . '...</a>'; } $sp = '..tas_pats_kas_postā..'; $newText = preg_replace_callback( $sp, 'url_replacer', $text ); PS: kļūdas pielabo pats Edited September 2, 2005 by Delfins Link to comment Share on other sites More sharing options...
Recommended Posts