Jump to content
php.lv forumi

news src tb /new/12-kalvitis-beidzot-klust-par-prezide


anonīms

Recommended Posts

Ideja veidot ir šādus linkus:

/new/12-kalvitis-beidzot-klust-par-prezide

Gribēju pavaicāt kā to vislabāk dabūt gatavu vai varbūt kādam jau ir gatavs kods, kas no jaunuma nosaukuma izveidotu šādu rindiņu?

Link to comment
Share on other sites

  function toSlug($s){
   if (function_exists('iconv')) {
     $s = @iconv('utf-8', 'us-ascii//TRANSLIT', $s);
   }
   $s = preg_replace("/[&<>]/", " ", $s);
   $s = preg_replace("/[^a-zA-Z0-9 -]/", "", $s);
   $s = preg_replace('/[\s]+/', '-', $s);
   $s = mb_strtolower($s);
   $s = trim($s, " \t. -");
   return $s;
 }

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...