Visa ett inlägg
Oläst 2008-01-02, 17:11 #3
mindphaser mindphaser är inte uppkopplad
Flitig postare
 
Reg.datum: Sep 2006
Inlägg: 423
mindphaser mindphaser är inte uppkopplad
Flitig postare
 
Reg.datum: Sep 2006
Inlägg: 423
Nope, det funkar inte heller för mig. Om jag tittar på hur tex phpbb gör så liknar det min lösning och det funkar inte om jag kopierar in och använder deras heller.

Att ersätta åäö samt mellanslagen funkar dock. Nån ide? Har jag missat någon setting, typ charset eller liknande?

Kod:
function make_url_friendly($url)
{
  $url = trim($url);
  $url = strtolower($url);
  // Fix for most recent topics block
  // or else a b is shown in every url
  $find = array('<b>',
   '</b>');
  $url = str_replace ($find, '', $url);
  $url = preg_replace('/<(\/{0,1})img(.*?)(\/{0,1})\>/', 'image', $url);
  $find = array(' ',
   '"',
   'quot',
   '&',
   'amp;',
   '\r\n',
   '\n',
   '/',
   '\',
   '+',
   '<',
   '>');
  $url = str_replace ($find, '-', $url);
  $find = array('é',
   'è',
   'ë',
   'ê',
   'É',
   'È',
   'Ë',
   'Ê');
  $url = str_replace ($find, 'e', $url);
  $find = array('í',
   'ì',
   'î',
   'ï',
   'Í',
   'Ì',
   'Î',
   'Ï');
  $url = str_replace ($find, 'i', $url);
  $find = array('ó',
   'ò',
   'ô',
   'Ó',
   'Ò',
   'Ô');
  $url = str_replace ($find, 'o', $url);
  $find = array('ö',
    'Ö');
  $url = str_replace ($find, 'o', $url);
  $find = array('á',
   'à',
   'â',
   'Á',
   'À',
   'å',
   'Å',
   'Â');
  $url = str_replace ($find, 'a', $url);
  $find = array('ä',
    'Ä');
  $url = str_replace ($find, 'a', $url);
  $find = array('ú',
   'ù',
   'û',
   'Ú',
   'Ù',
   'Û');
  $url = str_replace ($find, 'u', $url);
  $find = array('ü',
    'Ü');
  $url = str_replace ($find, 'ue', $url);
  $find = array('ß');
  $url = str_replace ($find, 'ss', $url);
  $find = array('ç');
  $url = str_replace ($find, 'c', $url);
  $find = array('/[^a-z0-9\-<>]/',
   '/[\-]+/',
   '/<[^>]*>/');
  $repl = array('',
   '-',
   '');
  $url = preg_replace ($find, $repl, $url);
  $url = str_replace ('--', '-', $url);
  return $url;
}
mindphaser är inte uppkopplad   Svara med citatSvara med citat