Pentiums Posted November 5, 2008 Report Share Posted November 5, 2008 Labvakar! Kā lai es aizstāju ā, ņ, š un citus simbolus ar attiecīgajiem - a, n, s.... gribu taisīt smukos urļus Link to comment Share on other sites More sharing options...
bubu Posted November 5, 2008 Report Share Posted November 5, 2008 RTFM. Manuālī ir tāda funkcija str_replace. Link to comment Share on other sites More sharing options...
Pentiums Posted November 5, 2008 Author Report Share Posted November 5, 2008 nu jā to es zināju, domā'ju ka ir kāda cita funkcija kas automātiski pārkonvertētu, bet nu labi, paldies, izmantošu šo :) Link to comment Share on other sites More sharing options...
KarlisBa Posted November 5, 2008 Report Share Posted November 5, 2008 Vai tad "smukajiem" uzrļiem parasti neizmanto mod_rewrite? Link to comment Share on other sites More sharing options...
Pentiums Posted November 5, 2008 Author Report Share Posted November 5, 2008 izmanto, bet ar mod_rewrite nedabūšu taču gatavu raksta virsraksta pārveidošanu uz parastajiem simboliem :) ar mod rewrite: raksts/17/Par_Kalvisa_treknajiem_gadiem bez: ?raksts=17&Par_Kalvisa_treknajiem_gadiem Tāpēc ar mod rewrite šeit nav nekāda sakara Link to comment Share on other sites More sharing options...
KarlisBa Posted November 5, 2008 Report Share Posted November 5, 2008 Skaidrs, būšu nedaudz pārpratis. Link to comment Share on other sites More sharing options...
Ghenis Posted November 6, 2008 Report Share Posted November 6, 2008 Var izlīdzēties ar iconv /** * @param string $title source string * @param string $charset string's charset * @return string * Converts all string chars to ASCII equievalents and replaces space with dash. */ function convert_slug($title, $charset='UTF-8'){ $title = iconv($title, 'ASCII//TRANSLIT', $title); $title = str_replace(' ', '-', $title); return urlencode($title); } Link to comment Share on other sites More sharing options...
blackhalt Posted November 7, 2008 Report Share Posted November 7, 2008 http://toooools.com/php/url-friendly-slug.html Link to comment Share on other sites More sharing options...
marcis Posted November 7, 2008 Report Share Posted November 7, 2008 <? function clean_title($title){ $title=strtolower($title); $chars=array("ā"=>"a","č"=>"c","ē"=>"e","ģ"=>"g","ī"=>"i","ķ"=>"k","ļ"=>"l","ņ"=>"n","š"=>"s","ū"=>"u","ž"=>"z","-"=>"_"," "=>"_",); $title=strtr($title,$chars); $title=ereg_replace("[^a-z0-9_]","",$title); return $title; } ?> Link to comment Share on other sites More sharing options...
Recommended Posts