I am trying to build an author page with the lists of your articles in com_contact (this option exists but it cannot paginate). I need it to be paginated. So I am creating arbitrarily without respecting the articles loaded by $this->item->articles
CODE
<?php
$db = JFactory::getDbo();
$app = JFactory::getApplication();
$limit = $app->getUserStateFromRequest("global.list.limit", 'limit', $app->getCfg('list_limit'), 'int');
$limitstart = $app->input->get('limitstart', 0, 'INT');
$query = $db->getQuery(true)
->select('SQL_CALC_FOUND_ROWS *')
->from('#__content')
->where('created_by = 439')
->order('publish_up DESC');
$db->setQuery($query, $limitstart, $limit);
$results = $db->loadAssocList();
if (!empty($results)) {
$db->setQuery('SELECT FOUND_ROWS();');
jimport('joomla.html.pagination');
$pager = new JPagination(73, $limitstart, $limit);
foreach ($results as $article) {
var_dump($article);
}
echo $pager->getPagesLinks();
}
I have not been able to obtain the total of the consultations, can you help me with that please? $db->loadResult()
counts the total of the matches of the current page and of the following pages less than the previous page, that means that while browsing the number of pages is reduced to 2.