argon
04-10-2009, 05:15 AM
When I enabled the SEO friendly URLs in Dynamics, I realised that my non-english characters in titles are gone away.
The dyna_fetch_spider_url (/includes/vba_dyna_functions.php) uses
preg_replace("/[^a-z_0-9 -]/i", '' to eliminate the characters other than 0-9, a-z, "_" and "-"
So "Özdemir Erdoğan" becomes "zdemir erdoan" which has nonsense for SEs.
Hook Location: vba_dyna_functions_dyna_fetch_spider_url
$preg_tr = array(array('/(ç)/ie','/(ğ)/ie','/(ı)/ie','/(ö)/ie','/(ş)/ie','/(ü)/ie','/(Ç)/ie','/(Ğ)/ie','/(İ)/ie','/(Ö)/ie','/(Ş)/ie','/(Ü)/ie'),
array('c','g','i','o','s','u','C','G','I','O','S','U'),
);
$text = preg_replace($preg_tr[0], $preg_tr[1],$text);
This code is executed before dyna's preg_replace and convert my Turkish characters to relevants. You can modify the preg_tr array to add your own language specific characters to be converted. Pay attention for the order of input and output characters.
I'm open for suggestions to make it better.
P.S. Dont forget to hit "Update Order" in "Manage Categories"
The dyna_fetch_spider_url (/includes/vba_dyna_functions.php) uses
preg_replace("/[^a-z_0-9 -]/i", '' to eliminate the characters other than 0-9, a-z, "_" and "-"
So "Özdemir Erdoğan" becomes "zdemir erdoan" which has nonsense for SEs.
Hook Location: vba_dyna_functions_dyna_fetch_spider_url
$preg_tr = array(array('/(ç)/ie','/(ğ)/ie','/(ı)/ie','/(ö)/ie','/(ş)/ie','/(ü)/ie','/(Ç)/ie','/(Ğ)/ie','/(İ)/ie','/(Ö)/ie','/(Ş)/ie','/(Ü)/ie'),
array('c','g','i','o','s','u','C','G','I','O','S','U'),
);
$text = preg_replace($preg_tr[0], $preg_tr[1],$text);
This code is executed before dyna's preg_replace and convert my Turkish characters to relevants. You can modify the preg_tr array to add your own language specific characters to be converted. Pay attention for the order of input and output characters.
I'm open for suggestions to make it better.
P.S. Dont forget to hit "Update Order" in "Manage Categories"