*

Recent

Author Topic: URL-address-diacritics  (Read 4107 times)

miunto

  • Newbie
  • *
  • Posts: 2
  • Force: +0/-0
URL-address-diacritics
« on: December 11, 2011, 04:18:19 AM »
I know that script, when rewrite mode is on  makes URL address from game title, but I would like write some game names in my language. Problem is, that I must use diacritics in name  and then in URL is just ----  without it. Can I somehow put it manually, address without diacritics ? Example - name řeřicha, to rericha for URL then googlebot can find it. Thanks

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: URL-address-diacritics
« Reply #1 on: December 11, 2011, 05:49:40 PM »
Im not positive on what you want but what i can think of to do is change the script to use the game ID instead of the game name in the url but that may take some rewriting of the script. I dont know how to make it convert the symbols to regular letters.

Adam LaCombe

  • Sr. Member
  • ****
  • Posts: 433
  • Force: +17/-0
    • My Blog
Re: URL-address-diacritics
« Reply #2 on: December 11, 2011, 05:57:14 PM »
Try using this:
Code: [Select]
$data = preg_replace('[\W]', '_', normalizer_normalize($data));

if you can't use normalizer_normalize(); then use this function instead:
Code: [Select]
function Unaccent($string)
{
    return preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8'));
}

miunto

  • Newbie
  • *
  • Posts: 2
  • Force: +0/-0
Re: URL-address-diacritics
« Reply #3 on: December 12, 2011, 08:57:42 AM »
O.K. can you tell me where to put code I tried template.php ?Here is page with bad address. http://kiwihry.cz/play/448-Gingerbread-Circus-2-Pern--ek-h-z--no-e--cirkus--online-hry.html

Adam LaCombe

  • Sr. Member
  • ****
  • Posts: 433
  • Force: +17/-0
    • My Blog
Re: URL-address-diacritics
« Reply #4 on: December 13, 2011, 06:13:33 PM »
it goes inside any file that contains a game link.

example would be /templates/TEMPLATE_NAME/base_home.php

look for:
Code: [Select]
$categorynamev = $row['name'];
$categorynameu = ereg_replace('[^A-Za-z0-9]', '-', $categorynamev );

and change it to:
Code: [Select]
$categorynamev = $row['name'];
$categorynamev = preg_replace('[\W]', ' ', normalizer_normalize($categorynamev));
$categorynameu = ereg_replace('[^A-Za-z0-9]', '-', $categorynamev );

But.. like spagetiokillers said, you could just use the ID in the url if you wanted to.. so just remove the name inside the url.