Re:SEF URLs 7 Years, 2 Months ago
|
Karma: 2
|
What complete changes do I need to make?
Code: |
$segments[] = $quizId . '-' . strtolower(preg_replace('/\-+/', '-', $quiz->QuizName));
$str = preg_replace('/\-+/', '-', $str);
|
|
|
|
|
|
Re:SEF URLs 7 Years, 2 Months ago
|
Karma: 760
|
It is enough to replace multiple dashes in a quiz name:
Code: |
$segments[] = $quizId . '-' . strtolower(preg_replace('/\-+/', '-', $quiz->QuizName));
|
Regards,
ARI Soft
|
|
|
|
|
Re:SEF URLs 7 Years, 2 Months ago
|
Karma: 2
|
this does not work
extra dashes are not removed
|
|
|
|
|
Re:SEF URLs 7 Years, 2 Months ago
|
Karma: 760
|
Find "_prepareSegments" method in router_ariquiz.php file and replace the following code:
Code: |
$updatedSegments[] = preg_replace(
'/[^A-z0-9\-\_]/i',
'',
iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $segment)
);
|
with the following one:
Code: |
$updatedSegments[] = preg_replace('/\-+/', '-', preg_replace(
'/[^A-z0-9\-\_]/i',
'',
iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $segment)
));
|
Regards,
ARI Soft
|
|
|
|
|
Re:SEF URLs 7 Years, 2 Months ago
|
Karma: 2
|
I have such a code in the file router_ariquiz.php:
Code: |
function _prepareSegments($segments)
{
$translit_tables = array(
'cyrillic' => array(
'original' => array(
'а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','п',
'р','с','т','у','ф','х','ц','ч','ш','щ','ъ','ы','ь','э','ю','я',
'А','Б','В','Г','Д','Е','Ё','Ж','З','И','Й','К','Л','М','Н','О','П',
'Р','С','Т','У','Ф','Х','Ц','Ч','Ш','Щ','Ъ','Ы','Ь','Э','Ю','Я'
),
'translit' => array(
'a','b','v','g','d','e','io','zh','z','i','y','k','l','m','n','o','p',
'r','s','t','u','f','h','ts','ch','sh','sht','a','i','y','e','yu','ya',
'A','B','V','G','D','E','Io','Zh','Z','I','Y','K','L','M','N','O','P',
'R','S','T','U','F','H','Ts','Ch','Sh','Sht','A','I','Y','e','Yu','Ya'
)
)
);
$updatedSegments = array();
foreach ($segments as $segment) {
foreach ($translit_tables as $translit_table) {
$updatedSegments[] = str_replace(
$translit_table['original'],
$translit_table['translit'],
$segment
);
}
}
if (!function_exists('iconv'))
return $updatedSegments;
setlocale(LC_ALL, 'en_US.UTF8');
foreach ($updatedSegments as &$segment)
{
$segment = preg_replace(
'/[^A-z0-9\-\_]/i',
'',
preg_replace(
'/[\s-\_]+/i',
'-',
iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $segment)
)
|
that it needs to be changed?
|
|
|
|
|
Re:SEF URLs 7 Years, 2 Months ago
|
Karma: 760
|
Try to add the following code:
Code: |
foreach ($updatedSegments as &$segment) $segment = preg_replace('/\-+/', '-', $segment);
|
before this code:
Code: |
if (!function_exists('iconv'))
return $updatedSegments;
|
Regards,
ARI Soft
|
|
|
|
|
|