I use a block of code like this wherever I need it:
PHP Code:
// Construct Page Navigation
$total = $dmEntry->viewTotalEntries($userid, $whereClause, $canViewPrivate);
$url = "viewblog.php?{$sID}userid=$userid";
$offset = ($vbulletin->GPC['page'] - 1) * $vbulletin->GPC['pp'];
$limit = "$offset, " . $vbulletin->GPC['pp'];
$pageNavigation = construct_page_nav($vbulletin->GPC['page'],
$vbulletin->GPC['pp'], $total, $url, '&pp=' . $vbulletin->GPC['pp']
);
You should only have to edit $total and $url for this to work. Make sure you have
PHP Code:
$vbulletin->input->clean_array_gpc('g', array(
'pp' => TYPE_UINT,
'page' => TYPE_UINT
));
in your code as well, and they SHOULD have default values... I use this function I wrote becuase I am lazy:
PHP Code:
defaultGPC( array(
'pp' => $vbulletin->options['blog_max_entry_display'],
'page' => 1
));
the function
PHP Code:
function defaultGPC($data)
{
global $vbulletin;
foreach ($data as $key => $value)
{
if (!$vbulletin->GPC[$key])
{
$vbulletin->GPC[$key] = $value;
}
}
}
If you aren't lazy, then just something like this:
Then placing something like:
PHP Code:
if (!$vbulletin->GPC['page'])
{
$vbulletin->GPC['page'] = 1;
}
if (!$vbulletin->GPC['pp'])
{
$vbulletin->GPC['pp'] = 15;
}
does the exact same thing.
HTML Code:
<if condition="$pageNavigation"><div align="right" style="margin-bottom: 5px">$pageNavigation</div></if>
<!-- main table -->
<if condition="$pageNavigation"><div align="right" style="margin-top: 5px">$pageNavigation</div></if>
To display it.