PDA

View Full Version : display non-english characters in spider url (SEO friendly url)


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"

jörg
08-03-2009, 07:18 PM
hi,

can you post the complete file, with your code in it?

Our Sponsors
 

argon
08-04-2009, 05:16 AM
There is no file modification required. Its'a plug-in. Add the code as a new plug-in through admincp.

jörg
08-04-2009, 08:29 AM
Hi,

thank you :)

It works fine by us :)

Our Sponsors
 

argon
08-05-2009, 05:26 PM
Glad to hear that.
u r welcome.