Reputation: 6852
I have problem with codeigniter something like this i have string this like
$string="Mučnina – problem u vožnji!";
When i do something like this
$url_title = url_title($string, '_', TRUE);
I got this
$string="munina_problem_u_vonji";
Big difference?
How to modified url_title parameters?
Upvotes: 4
Views: 3592
Reputation: 6852
This is what i done :
1. go to application/config/foreign_chars.php
2. added
'/š/' => 's',
'/đ/' => 'd',
'/č/' => 'c',
'/ć/' => 'c',
'/ž/' => 'z',
'/Š/' => 'S',
'/Đ/' => 'D',
'/Č/' => 'C',
'/Ć/' => 'C',
'/Ž/' => 'Z',
3. Just call
$clean=convert_accented_characters($string);
$url_title = url_title($clean, '_', TRUE);
Upvotes: 4
Reputation: 20753
The built-in url title function won't work in itself for you since it's just replaces everyting matches [^a-z0-9 _-]
with empty string.
Try running convert_accented_characters()
first on your input, that function takes it's replacements from the config/foreign_chars.php
file, so something like this:
url_title(convert_accented_characters($string), '_', TRUE);
Upvotes: 3