Hi Teitbite,
I posted a ticket in VIP support but my VIP account is out of date so can you please help me here? I copied my problem here:
I am using CB in my site. CB component helps to manage users and users can add articles from the front end.
When user post an article from front-end, CB will create an alias for that article. And they use following codes:
--------------------
private static function getTitleAlias( $title )
{
$alias = str_replace( '-', ' ', $title );
$alias = trim( cbIsoUtf_strtolower( $alias ) );
$alias = preg_replace( '/(\s|[^A-Za-z0-9\-])+/', '-', $alias );
$alias = trim( $alias, '-' );
return $alias;
}
------------------
In this file:
components/com_comprofiler/plugin/user/plug_cbblogs/models/joomla25.php
The codes work well with English title.
But with Vietnamese which have some special characters as: ù ú ụ ủ ũ ì í ị ỉ ĩ ò ó ọ ỏ õ è é ẹ ẻ ẽ d á à ạ ả ã đ â ỡ ở ừ ứ ự ử ữ ơ ờ ớ ợ ư ỗ ổ ộ ố ồ ô ễ ể ệ ế ề ê ẵ ẳ ặ ắ ằ ă ẫ ẩ ậ ấ ầ.
When the title of an article have one of those special charaters, it will become a dash “-“.
For example:
If the title is “Anh yêu em rất nhiều”
The alias is: “anh-y-u-em-r-t-nhi-u”
And it is not readable by human.
What I want is that the special characters become normal Latin characters. For example, with the above title, the alias will be: “anh-yeu-em-rat-nhieu”
But I do not know how to do.
At the moment, I am using following codes instead:
-------------
private static function getTitleAlias( $title )
{
$alias = str_replace( '-', ' ', $title );
$alias = trim( cbIsoUtf_strtolower( $alias ) );
$alias = preg_replace( '/(\s|[^A-Za-z0-9ùúụủũìíịỉĩòóọỏõèéẹẻẽđáàạảãđâỡởừứựửữơờớợưỗổộốồôễểệếềêẵẳặắằăẫẩậấầ\-])+/', '-', $alias );
$alias = trim( $alias, '-' );
return $alias;
}
-------------
And the alias becomes: “anh-yêu-em-rất-nhiều”
With this alias, sometimes it is readable, but sometimes it becomes as follows:
“anh-yêu-em-rất-nhiều”
And it does not look nice and also cannot be read.
Please help me to change the codes so that the alias will become:
“anh-yeu-em-rat-nhieu”
In order to do that
ừ,ứ,ự,ử,ữ,ư, ù, ú, ụ, ủ, ũ will become u
ì, í, ị, ỉ, ĩ will become i
ễ,ể,ệ,ế,ề,ê,è,é,ẹ,ẻ,ẽ will become e
á,à,ạ,ả,ã,â,ẵ,ẳ,ặ,ắ,ằ,ă,ẫ,ẩ,ậ,ấ,ầ will become a
đ will become d
ò,ó,ọ,ỏ,õ,ơ,ờ,ớ,ợ,ỗ,ổ,ộ,ố,ồ,ô,ỡ,ở will become o
Thank you very much for your help so far,
Hai