anonīms Posted June 19, 2010 Report Share Posted June 19, 2010 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 More sharing options...
marcis Posted June 19, 2010 Report Share Posted June 19, 2010 Tāda funkcija ir vismaz 99% freimworku, tāpat arī 873492834 varianti atrodami šajā forumā. Link to comment Share on other sites More sharing options...
codez Posted June 19, 2010 Report Share Posted June 19, 2010 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 More sharing options...
anonīms Posted June 19, 2010 Author Report Share Posted June 19, 2010 marcis, paskaties uz codez - nebija nemaz tik grūti, ne? :D no offence Man vnk pietrūka mazliet laika, jo paralēli daru citus darbus. Tādēļ arī rakstīju pie gataviem skriptiem Link to comment Share on other sites More sharing options...
mefisto Posted June 19, 2010 Report Share Posted June 19, 2010 Ja tu nespēji pats to uzrakstī 2ās minūtēs, tad varbūt tev tomēr nevajadzetu izlikties par programētāju. Varbūt pamēģni biškopību. Link to comment Share on other sites More sharing options...
anonīms Posted June 19, 2010 Author Report Share Posted June 19, 2010 skarbi... preg_replace nekad nav bijusi mana stiprā puse... Peace Link to comment Share on other sites More sharing options...
Recommended Posts