extend the alpha index

More
13 years 1 month ago #14807 by jwwicks
Replied by jwwicks on topic extend the alpha index
The other issue is how to deal with the front-end comparison to the array elements in category-alpha.php

I believe you could use the JLanguage::transliterate method to compare instead of the in_array which won't match the Ó etc...

Haven't tried it yet, just spit-balling/brain storming.

Since this method of the category model returns the $this->alpha used in the template, and it takes into account the current language,
Code:
/** * Method to build the alphabetical index * * @access public * @return string * @since 1.5 */ function getAlphaindex() { $user = & JFactory::getUser(); $gid = (int) $user->get('aid'); $lang = JRequest::getWord('lang', '' ); // Get the category parameters $cparams = $this->_category->parameters; // show unauthorized items $show_noauth = $cparams->get('show_noauth', 0); // Filter the category view with the active active language $and = FLEXI_FISH ? ' AND ie.language LIKE ' . $this->_db->Quote( $lang .'%' ) : ''; $and2 = $show_noauth ? '' : ' AND c.access <= '.$gid.' AND i.access <= '.$gid; $_group_cats = implode("','", $this->_group_cats); $query = 'SELECT LOWER(SUBSTRING(i.title FROM 1 FOR 1)) AS alpha' . ' FROM #__content AS i' . ' LEFT JOIN #__flexicontent_items_ext AS ie ON i.id = ie.item_id' . ' LEFT JOIN #__flexicontent_cats_item_relations AS rel ON rel.itemid = i.id' . ' LEFT JOIN #__categories AS c ON c.id IN (\''. $_group_cats .'\')' . ' WHERE rel.catid IN (\''. $_group_cats .'\')' . $and . ' AND i.state IN (1, -5)' . ' AND i.sectionid = '.FLEXI_SECTION . $and2 . ' GROUP BY alpha' . ' ORDER BY alpha ASC'; ; $this->_db->setQuery($query); $alpha = $this->_db->loadResultArray(); return $alpha; }

I would think that if you walked the alpha array and transliterated it with JLanguage you'd wind up with an enabled alpha-index for the english equivalent character.

Jw

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.250 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