This goes on the beginning of the main php file. it defines the navigation object:
Code: Select all
$limit = $mainframe->getUserStateFromRequest( "viewlistlimit", 'limit', 10 );
$limitstart = $mainframe->getUserStateFromRequest( "view{$option}limitstart", 'limitstart', 0 );
$rows = array();
$dbdest->setQuery( "SELECT COUNT(*) FROM #__destaques" );
$total = $dbdest->loadResult();
$pageNav = new mosPageNav( $total, $limitstart, $limit );
Code: Select all
function listDestaques( $option )
{
global $mainframe, $my;
global $mosConfig_live_site;
global $Itemid;
global $dbdest, $pageNav;
global $mosConfig_list_limit;
$query = "SELECT id, url, title, description, date, hits, params, ordering, published, checked_out"
. "\n FROM #__destaques"
. "\n ORDER BY ordering"
. "\n LIMIT $pageNav->limitstart,$pageNav->limit"
;
$dbdest->setQuery( $query );
$rows = $dbdest->loadObjectList();
$menu = new mosMenu( $dbdest );
$menu->load( $Itemid );
$params = new mosParameters( $menu->params );
$params->def( 'page_title', 1 );
$params->def( 'header', $menu->name );
$params->def( 'pageclass_sfx', '' );
$params->def( 'headings', 1 );
$params->def( 'hits', $mainframe->getCfg( 'hits' ) );
$params->def( 'item_description', 1 );
$params->def( 'other_cat_section', 1 );
$params->def( 'other_cat', 1 );
$params->def( 'description', 1 );
$params->def( 'description_text', _WEBLINKS_DESC );
$params->def( 'image', '-1' );
$params->def( 'destaque_icons', '' );
$params->def( 'image_align', 'right' );
$params->def( 'back_button', $mainframe->getCfg( 'back_button' ) );
$tabclass = array( 'sectiontableentry1', 'sectiontableentry2' );
HTML_destaques::displaylist( $rows, $params, $tabclass, $option, $pageNav );
}
Some of the parameters necessary to use the methods that build the arrows and allow the reordering are defined here:
Code: Select all
for ($i=0, $n=count( $rows ); $i < $n; $i++)
{
$row = $rows[$i];
$iparams = new mosParameters( $row->params );
$link = sefRelToAbs( 'index.php?option=com_destaques&task=view&id='. $row->id );
Code: Select all
<td>
<?php echo $pageNav->orderUpIcon( $i, TRUE); ?>
</td>
<td colspan="2" align="center" class="<?php echo "row$k"; ?>">
</td>
<td>
<?php echo $pageNav->orderDownIcon( $i, $n, TRUE); ?>
</td>
The last instance of the pagenav object is here:
Code: Select all
$pageNav->getListFooter();
I have compared it to the com_content code (backend), and (to me) the codes are all in the right places, but the resulting pagination is a mess. Only 1 item is listed at a time, the reordering is not working, it is a complete chaos. if someone who have experienced this or something close to it, or have a better knowing of the pageNav class and want to help, i will be very thankful!