***Generate URL from text***
I have a code here which actually generate url from my articles title from a directory script.
The questin is how can I make it to replace words like áóÃúé etc... (iso-8859-2) characters into a friendly url. So from "á" will be "a" etc..
At the moment all these foriner characters getting replaced with " - "
Can anyone help me to figure out this issue? Thx.
Here is the code:
function generateUrl($title) { $title= preg_replace('/[^A-Za-z0-9-]/', ' ', $title); $title= preg_replace('/ +/', ' ', $title); $title= trim($title); $title= str_replace(' ', '-', $title); $title= preg_replace('/-+/', '-', $title); $title= strtolower($title); return $title; }
Thanks & Regards,
Reach us at dukeduke600@gmail.com.
Web Design| Logo Design | Banner Design | Web Development | Mobile Applications [iPhone/iPad/Android/Windows Phone]