Barba realistica con photoshop! Slideshow dinamica con actionscript 3 e xml!




Mar 30

Una funzione molto utile che vi permetterà di creare SEO url in stile web 2.0!

 
< ?php
function make_seo_title($str)
{
// html decode, in case it is coming encoded (AJAX request)
$seo_title = rawurldecode($str);
// some characters that might create trouble
$switch_chars = ‘(,),\,/’;
$sc = explode(‘,’, $switch_chars);
foreach ($sc as $c) $seo_title = str_replace($c, ‘-’, $seo_title);
// leave only alphanumeric characters and replace spaces with hyphens
$seo_title = strtolower(str_replace(‘–’, ‘-’, preg_replace(‘/[\s]/’, ‘-’, preg_replace(‘/[^[:alnum:]\s-]+/’, , $str))));
$len = strlen($seo_title);
if ($seo_title[$len - 1] == ‘-’) $seo_title = substr($seo_title, 0, -1);
if ($seo_title[0] == ‘-’) $seo_title = substr($seo_title, 1, $len);
return $seo_title;
}
?>
 

fonte: www.sastgroup.com » Vai al post originale





Scrivi un commento