Pentiums Posted November 5, 2008 Report 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
bubu Posted November 5, 2008 Report Posted November 5, 2008 RTFM. Manuālī ir tāda funkcija str_replace.
Pentiums Posted November 5, 2008 Author Report 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 :)
KarlisBa Posted November 5, 2008 Report Posted November 5, 2008 Vai tad "smukajiem" uzrļiem parasti neizmanto mod_rewrite?
Pentiums Posted November 5, 2008 Author Report 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
Ghenis Posted November 6, 2008 Report 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); }
blackhalt Posted November 7, 2008 Report Posted November 7, 2008 http://toooools.com/php/url-friendly-slug.html
marcis Posted November 7, 2008 Report 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; } ?>
Recommended Posts