Page 1 of 1

Add transliteration slug (friendly url)

Posted: Tue Sep 29, 2015 7:47 am
by voron
Hi Diego! Can you adding auto transliteration for slug (friendly url)?

Re: Add transliteration slug (friendly url)

Posted: Wed Sep 30, 2015 1:10 am
by diego
Hi voro,
it implemented, I used iconv (http://php.net/manual/en/book.iconv.php), may be you don't have installed this module.

You have your own server ?

Code: Select all

	public static function cleanUrl($string, $separator='-')
	{
		if(function_exists('iconv')) {
			$string = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
		}

		$string = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $string);
		$string = trim($string, '-');
		$string = self::lowercase($string);
		$string = preg_replace("/[\/_|+ -]+/", $separator, $string);

		return $string;
	}

Re: Add transliteration slug (friendly url)

Posted: Wed Sep 30, 2015 8:53 am
by voron
diego wrote:Hi voro,
it implemented, I used iconv (http://php.net/manual/en/book.iconv.php), may be you don't have installed this module.

You have your own server ?
iconv is installed, see the phpinfo http://bludit.ml/phpinfo.php
try enter title of post in cyrillic lang eg. тест
http://bludit.ml/admin
pass: 326764

Re: Add transliteration slug (friendly url)

Posted: Thu Oct 01, 2015 4:41 am
by diego
Yes I saw the problem.. I am searching a solution for it, have you some recomendation ? thanks

Re: Add transliteration slug (friendly url)

Posted: Thu Oct 01, 2015 8:07 am
by voron
diego wrote:Yes I saw the problem.. I am searching a solution for it, have you some recomendation ? thanks
Good works only character map

Code: Select all

array (
  'А'=>'a','Б'=>'b','В'=>'v',
    'Г'=>'g','Д'=>'d','Е'=>'e','Ё'=>'yo','Ж'=>'zh',
    'З'=>'z','И'=>'i','Й'=>'j','К'=>'k','Л'=>'l',
    'М'=>'m','Н'=>'n','О'=>'o','П'=>'p','Р'=>'r',
    'С'=>'s','Т'=>'t','У'=>'u','Ф'=>'f','Х'=>'h',
    'Ц'=>'c','Ч'=>'ch','Ш'=>'sh','Щ'=>'shh','Ъ'=>'',
    'Ы'=>'y','Ь'=>'','Э'=>'e','Ю'=>'yu','Я'=>'ya',
    'а'=>'a','б'=>'b','в'=>'v','г'=>'g','д'=>'d',
    'е'=>'e','ё'=>'yo','ж'=>'zh','з'=>'z','и'=>'i',
    'й'=>'j','к'=>'k','л'=>'l','м'=>'m','н'=>'n',
    'о'=>'o','п'=>'p','р'=>'r','с'=>'s','т'=>'t',
    'у'=>'u','ф'=>'f','х'=>'h','ц'=>'c','ч'=>'ch',
    'ш'=>'sh','щ'=>'shh','ъ'=>'','ы'=>'y','ь'=>'',
    'э'=>'e','ю'=>'yu','я'=>'ya',' '=>'-','-'=>'-','»'=>''
);
Remember as you did in nibbleblog?

Re: Add transliteration slug (friendly url)

Posted: Fri Oct 02, 2015 1:31 am
by diego
Yes I remember the array list, but I'm looking for another way.

Some CMS uses the slug directly тест instead test, I'm thinking uses characters in UTF in the URI.

Re: Add transliteration slug (friendly url)

Posted: Fri Oct 02, 2015 6:31 am
by diego
Done, after a while searching a better solution on Google, I used the array with the characters.
Please download the version from Github and let me know if there are some error.

thanks

Re: Add transliteration slug (friendly url)

Posted: Fri Oct 02, 2015 6:31 am
by diego
I move the topic to General forum.

Re: Add transliteration slug (friendly url)

Posted: Fri Oct 02, 2015 9:05 am
by voron
diego wrote:Done, after a while searching a better solution on Google, I used the array with the characters.
Please download the version from Github and let me know if there are some error.

thanks
All works fine, thank!

Re: Add transliteration slug (friendly url)

Posted: Sat Mar 02, 2024 8:44 pm
by albel
Hello! Help me!
Please tell me how to add automatic transliteration for slug (friendly URL) in Bludit v3.15.0? Unfortunately, I didn't understand how the issue was resolved in this topic. I'm not very familiar with PHP and English language.