Jump to content
php.lv forumi

Aizstāt latviešu burtus ar parastajiem


Pentiums

Recommended Posts

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

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

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

<?
  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

×
×
  • Create New...