1
slider84
Pagenav in block
  • 2014/6/14 18:14

  • slider84

  • Just popping in

  • Posts: 21

  • Since: 2013/8/16


Hello,

Is there a special way to integrate a navigation page (pagenav) in a block?
I regularly integrates seamlessly but this is the first time I try to integrate it into a block and it does not work: The corresponding variable {$ smarty} pagenav is desperately empty (empty). Other smarty variable {$ limit} and {$ start} are good.
I turned my code in all directions with no results.

<?php

if (!defined('XOOPS_ROOT_PATH')) { exit(); }

function 
b_xxx_lastregister_show($options) {
include_once 
XOOPS_ROOT_PATH '/modules/xxx/class/main.php';
include_once 
XOOPS_ROOT_PATH '/class/pagenav.php';
global 
$xoopsDB;

$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
$block = array();
$criteria='';
$modhandler = &xoops_gethandler('module');
$xoopsModule = &$modhandler->getByDirname("xxx");
$config_handler = &xoops_gethandler('config');
$xoopsModuleConfig = &$config_handler->getConfigsByCat(0,$xoopsModule->getVar('mid'));
$module_dirname $xoopsModule->getVar('dirname');
$xxx_main_handler = & xoops_gethandler('xxx_main');

// pagenav
$limit $xoopsModuleConfig['maxreg'];
$criteria=new Criteria('validate',1);   
$criteria->setLimit($limit);
$criteria->setStart($start);
$count $xdm_main_handler->getCount($criteria);
$query_entry 'limit=' $limit ;

// pagenav to template
$pagenav = new XoopsPageNav($count$limit$start'start'$query_entry );
$GLOBALS['xoopsTpl']->assign('pagenav', !empty($pagenav) ? $pagenav->renderNav() : '');
$GLOBALS['xoopsTpl']->assign('start'$start);
$GLOBALS['xoopsTpl']->assign('limit'$limit);

// code, code, and more code ...

return $block;
}
?>

I am on xoops 2.5.7 RC2 (for final tests)
Ubuntu 12.04 server-Apache 2.2.22-MySQL 5.5.31-Php 5.3.10

2
slider84
Re: Pagenav in block
  • 2014/6/14 21:57

  • slider84

  • Just popping in

  • Posts: 21

  • Since: 2013/8/16


Solved:
$xoopsModuleConfig['maxreg'] for $limit variable was greater than the number of records returned by my query

Login

Who's Online

220 user(s) are online (141 user(s) are browsing Support Forums)


Members: 0


Guests: 220


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits