1
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.
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