Visa ett inlägg
Oläst 2011-12-17, 15:40 #3
youheardit youheardit är inte uppkopplad
Har WN som tidsfördriv
 
Reg.datum: Oct 2008
Inlägg: 1 168
youheardit youheardit är inte uppkopplad
Har WN som tidsfördriv
 
Reg.datum: Oct 2008
Inlägg: 1 168
Själv använder jag denna funktionen i PHP på en av mina sidor som har liknande behov som din.

PHP-kod:
function generateSlug($phrase)
{

    
$from = array("å","ä","ö","Å","Ä","Ö");

    
$to = array("a","a","o","A","A","O");

    
$result str_replace($from,$to,$phrase);
    
$result strtolower($result);

    
    
$result preg_replace("/[^a-z0-9\s-]/"""$result);
    
$result trim(preg_replace("/[\s-]+/"" "$result));
    
$result trim($result);
    
$result preg_replace("/\s/""-"$result);

    return 
$result;

youheardit är inte uppkopplad   Svara med citatSvara med citat