senters Posted March 28, 2012 Report Share Posted March 28, 2012 Linkos tiek padoti nosaukumi - /event/nosaukums+ar+garumzīmēm. Kā šo stringu pārkonvertēt uz - /event/nosaukums+ar+garumzimem? Link to comment Share on other sites More sharing options...
briedis Posted March 28, 2012 Report Share Posted March 28, 2012 Pameklē google: "php seo string". Tepat bija arī topiks "Noderīgs funkcijas", tur to arī var atrast. Link to comment Share on other sites More sharing options...
senters Posted March 28, 2012 Author Report Share Posted March 28, 2012 Jā, uz sitiena atradu šo - http://www.bitrepository.com/php-format-text-into-a-seo-friendly-string.html Jāpaskatās Link to comment Share on other sites More sharing options...
briedis Posted March 28, 2012 Report Share Posted March 28, 2012 Tevis atraistais ir kaut kas pabriesmīgs, nav ticības, kas strādās ar garumzīmēm. Pameklē šeit noderīgās funkcijās, ir manis dota funkcija, kas strādā pat ar krievu burtiem. Link to comment Share on other sites More sharing options...
senters Posted March 28, 2012 Author Report Share Posted March 28, 2012 Risinājums (ja nu kādam noder): function url_friendly($text) { $url = strtolower($text); $utf = array('ā', 'ē', 'ī', 'ū', 'č', 'ģ', 'ķ', 'ļ', 'ņ', 'ŗ', 'š', 'ž', 'Ā', 'Ē', 'Ī', 'Ū', 'Č', 'Ģ', 'Ķ', 'Ļ', 'Ņ', 'Ŗ', 'Š', 'Ž'); $ltn = array('a', 'e', 'i', 'u', 'c', 'g', 'k', 'l', 'n', 'r', 's', 'z', 'a', 'e', 'i', 'u', 'c', 'g', 'k', 'l', 'n', 'r', 's', 'z'); $url = str_replace($utf, $ltn, $url); $url = preg_replace('/\s/', '-', $url); $url = preg_replace('/[^\w\-]/', '', $url); return $url; } Link to comment Share on other sites More sharing options...
senters Posted March 28, 2012 Author Report Share Posted March 28, 2012 Briedi, taisnība par to iepriekšējo - garām. Šī ko iepostoju ir pa pirmo. Link to comment Share on other sites More sharing options...
daGrevis Posted March 29, 2012 Report Share Posted March 29, 2012 iconv(). Link to comment Share on other sites More sharing options...
Recommended Posts