Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Kiekvienam siuntiniui atskiri keywordai

Parašė Kelmas· 2010 Bal. 20 11:04:14
#7

And2s parašė:
function keywords($string){
    $string = preg_replace("/Ą/","ą",$string);
    $string = preg_replace("/Č/","č",$string);
    $string = preg_replace("/Ę/","ę",$string);
    $string = preg_replace("/Ė/","ė",$string);
    $string = preg_replace("/Į/","į",$string);
    $string = preg_replace("/Š/","š",$string);
    $string = preg_replace("/Ų/","ų",$string);
    $string = preg_replace("/Ū/","ū",$string);
    $string = preg_replace("/Ž/","ž",$string);
   $string = preg_replace("`\[.*\]`U","",$string);
   $string = preg_replace('`&(amp;)?#?[a-z0-9]+;`i',',',$string);
   $string = htmlentities($string, ENT_COMPAT, 'utf-8');
   $string = preg_replace( "`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig|quot|rsquo);`i","\\1", $string );
   $string = preg_replace( array("`[^a-z0-9]`i","`[-]+`") , ",", $string);
   return strtolower(trim($string, ','));
}




Šitą funkciją įsidėk į maincore.php.
naudojimas: keywords(siuntinio pavadinimas).. :) pvz sakinį "Kurias WEB technologijas esate perpratę?
" suskaldys į keywordus: "kurias,web,technologijas,esate,perpratę" :)


Ilgas variantas. :) Galime puse kodo pritaikyti iš mano temos.

$string = preg_replace("/Ą/","ą",$string);
$string = preg_replace("/Č/","č",$string);
$string = preg_replace("/Ę/","ę",$string);
$string = preg_replace("/Ė/","ė",$string);
$string = preg_replace("/Į/","į",$string);
$string = preg_replace("/Š/","š",$string);
$string = preg_replace("/Ų/","ų",$string);
$string = preg_replace("/Ū/","ū",$string);
$string = preg_replace("/Ž/","ž",$string);




// Sušveplinam
$string = iconv('UTF-8', 'US-ASCII//TRANSLIT', $string);



Redagavo Kelmas· 2010 Bal. 20 11:04:40