Jump to content
php.lv forumi

izveidot link href


anonīms

Recommended Posts

Ideja ir tāda, ka ja caur admin paneli mēģina izveidot izvēlnes linku, teiksim, Arājs, tad db nonāk link_src, kur būtu arajs

Arājs => arajs

manā lapā => mana_lapa

 

Nevēlos izvelni ar id veidot. Pārāk bezpersoniski.

Kā to varētu panākt?

Link to comment
Share on other sites

$lielie = array('Ā','ā','Č','č','Ē','ē','Ģ','ģ','Ī','ī','Ķ','ķ','Ļ','ļ','Ņ','ņ','Š','š','Ū','ū','Ž','ž','ō','Ō',' ','Æ','æ','Ø','ø','Å','å');

$mazie = array ('a','a','c','c','e','e','g','g','i','i','k','k','l','l','n','n','s','s','u','u','z','z','o','o',' ','ae','ae','o','o','aa','aa');

$url = strtolower(str_replace($lielie,$mazie,$string));

Link to comment
Share on other sites

es linkus veidoju šādi

  function fuckchars($str){
$chars=array('ā"=>"a","č"=>"c","ē"=>"e","ģ"=>"g","ī"=>"i","ķ"=>"k","ļ"=>"l","ņ"=>"n","š"=>"s","ū"=>"u","ž"=>"z"," "=>"_",);
$str=strtolower($str);
$str=strtr($str,$chars);
$str=ereg_replace("[^a-z0-9_]","",$str);
return $str;
 }

Edited by marcis
Link to comment
Share on other sites

×
×
  • Create New...