Example #1
0
<?php

// $Id$
// --------------------------------------------------------------
// Professional Works
// Advanced Portfolio System
// Author: BitC3R0 <*****@*****.**>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
define('PW_LOCATION', 'index');
$xoopsOption['template_main'] = 'pw_index.html';
$xoopsOption['module_subpage'] = 'index';
include 'header.php';
PWFunctions::makeHeader();
$tpl->assign('works_subpage', 'index');
//Barra de NavegaciĆ³n
$sql = "SELECT COUNT(*) FROM " . $db->prefix('pw_works') . " WHERE public=1";
list($num) = $db->fetchRow($db->query($sql));
$limit = $mc['num_recent'];
$limit = $limit <= 0 ? 10 : $limit;
if (!isset($page)) {
    $page = rmc_server_var($_GET, 'page', 1);
}
$tpages = ceil($num / $limit);
$page = $page > $tpages ? $tpages : $page;
$start = $num <= 0 ? 0 : ($page - 1) * $limit;
$start = $start < 0 ? 0 : $start;
$nav = new RMPageNav($num, $limit, $page, 5);
$url = $xoopsModuleConfig['urlmode'] ? XOOPS_URL . rtrim($xoopsModuleConfig['htbase'], '/') . '/page/{PAGE_NUM}/' : XOOPS_URL . '/modules/works/?page={PAGE_NUM}';
$nav->target_url($url);