Russian alpha index

More
14 years 9 months ago #3464 by HUNTER
Russian alpha index was created by HUNTER
How to add support of russian language to alpha index of flexicontent?

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #3474 by vistamedia
Replied by vistamedia on topic Russian alpha index
Hi,
This is a good question :)
What happens if you edit components/com_flexicontent/templates/default(or your template)/category_alpha.php
and replace line 25
Code:
$letters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
by your alphabet?
I've no experience with that but it may probably function.
Cheers,
Emmanuel.

FLEXIcontent lead developer.
www.vistamedia.fr web agency and custom development.
www.joomla.fr co-administrator.
Please no PM for support request, use the forum for that!!!

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #3492 by HUNTER
Replied by HUNTER on topic Russian alpha index
In category_alpha.php

i has replaced strtoupper($letter) to
mb_strtoupper($letter), because strtoupper() doesn't support russian UTF8 encoding.

in category.php i changed the line to mb
$alpha[] = mb_strtolower(substr($title, 0, 1));

letters array looks like this:
$letters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'а', 'б', 'в', 'г', 'д', 'е', 'ж', 'з', 'и', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф');

Changed letters array displayed correctly, however works only english index.

It seems russian symbols parsed incorrectly ( with enabled print_r($alpha) in code) it looks:

Array
(
[0] => �
[1] => t
[2] => b
)

[0] - its a russian symbol


Can you provide list of files where stored alphaindex functions? I try to fix this issue with yours help.

Thank You!

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #3499 by vistamedia
Replied by vistamedia on topic Russian alpha index
Hi,
The alpha index is processed as the filters. That means you can find it in the _buildItemWhere() method in the category model.
To link only the letters that have articles in, I use then the getAlphaindex() method
Any suggestion to improve that and make utf8 compliant is welcome.
Cheers,
Emmanuel.

FLEXIcontent lead developer.
www.vistamedia.fr web agency and custom development.
www.joomla.fr co-administrator.
Please no PM for support request, use the forum for that!!!

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #3532 by HUNTER
Replied by HUNTER on topic Russian alpha index
Found some info about handling UTF-8 encoding:

substr
Impact: accepts arguments in bytes positions not characters - could corrupt a UTF-8 string

If used in an arbitrary manner to chop off part of a string, it could potentially split UTF-8 sequences resulting in corruption. At the same time if used in conjunction with functions like strpos (see notes above), would be able to extract a portion of a UTF-8 string without corrupting it, although you’ll be passing it arguments in terms of byte positions not character positions.

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #3533 by HUNTER
Replied by HUNTER on topic Russian alpha index
I added to all alphaindex functions mb_ prefix

$alpha[] = mb_strtolower(mb_substr($title, 0, 1));

symbols displays correctly, but sorting and indexing do not works ((

may be javascript function getElementById incorrectly parse ?

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.713 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline