Hi,
In alphabetical.php in com_abc (front-end) and in abc.php:
| Code: |
<?php
/**
* ABC alphabetical model
* This model gives better SEF compatibility.
* It uses view and task CGI parameters.
*
* @package Joomla
* @subpackage Components
* @link http://www.airiny.com
* @license GNU/GPL
* @version $Id$
* @modified jSeblod team
* @todo Pagination
*/
// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.model' );
/**
* Model for content in alphabetical order
* @package Joomla
* @subpackage Components
*/
class AbcModelAlphabetical extends JModel
{
/**
* Gets the greeting
* @return string The greeting to be displayed to the user
*/
function getArticles()
{
$letter = JRequest::getVar('task', 'a', '');
$catid = JRequest::getVar('catid', false);
$sectionid = JRequest::getVar('sectionid', false);
$db =& JFactory::getDBO();
$lg = &JFactory::getLanguage();
$language = $lg->_lang;
//seblod
jimport('joomla.application.component.helper');
$query_lang = "select id, ordering from #__languages where code='".$language."'";
$db->setQuery( $query_lang );
$lang = $db->loadRow();
$lang_id = $lang[0];
$lang_order = $lang[1];
if(JComponentHelper::isEnabled('com_joomfish', true) and $lang_order!=0)
{
$where = $catid ? " AND t2.catid = $catid" : '';
$where .= $sectionid ? " AND t2.sectionid = $sectionid" : '';
//With Joomfish
$query = "SELECT reference_id AS id, value AS title FROM #__jf_content as t1 LEFT JOIN #__content AS t2 ON t1.reference_id = t2.id"
." WHERE reference_table = 'content' and reference_field = 'title' and language_id = ".$lang_id ." and published = 1"
." AND UPPER(value) LIKE '$letter%'"
.$where
." GROUP BY value"
." ORDER BY value"
;
}else{
//Without Joomfish
$where = $catid ? " AND catid = $catid" : '';
$where .= $sectionid ? " AND sectionid = $sectionid" : '';
$query = "SELECT id, title FROM #__content"
." WHERE state = 1"
." AND UPPER(title) LIKE '$letter%'"
.$where
." GROUP BY title"
." ORDER BY title"
;
}
//echo "<br>DEBUG: SQL: $query";
$db->setQuery( $query );
$articles = $db->loadObjectList();
if ($db->getErrorNum()) { //@todo log
echo 'Error ' . $db->getErrorNum() . ': ' . $db->getErrorMsg();
}
return $articles;
}
}
?>
|
Will be great to include this in the new version.
Best Regards.