- Moderated by:
- Support
-
- rank:
-
Freshman
- registered:
- March 2004
- Status:
- offline
- last visit:
- 24.03.04
- Posts:
- 3
Does anyone have a fix for the missing topic id in pnNewsX 1.6?
When viewing news by topic it doesn't have the id for the next or previous pages... the links on the index page works fine for browsing through all topics.
example URL:
modules.php?op=modload&name=News&file=index&catid=&topic=&startrow=10
module available here:
http://mods.postnuke.com/modules.php?op=modload&name=News&file=article&sid=1232 -
- rank:
-
Freshman
- registered:
- March 2004
- Status:
- offline
- last visit:
- 24.03.04
- Posts:
- 3
From modules/News/funcs.php (will post full code if needed - thanx by the way for taking a look!):
Code
function printlinks($pagelinks=5, $storynum=5, $num_record )
{
global $startrow;
// Calculate the total number of pages
$pages = intval($num_record / $storynum);
// $pages now contains number of pages needed unless there are left over from division
if ($num_record % $storynum)
{
// has left over from division, so add one page
$pages++;
}
$last = ($pages * $storynum) - $storynum;
if( $pages == 1 )
{
echo(""._PAGETOTAL." "._PAGETEXT.": <b>$pages</b><br><br>");
}
else
{
echo(""._PAGETOTAL." "._PAGETEXTS.": <b>$pages</b><br><br>");
}
$cur_page = ceil( $startrow / $storynum ) + 1;
$check = intval(($cur_page-1) / $pagelinks)*$pagelinks + 1;
// Calculate the previous results, only print 'Previous' if startrow is not equal to zero
if ($startrow != 0 && ($startrow >= ($storynum * $pagelinks)))
{
//$prevrow = $startrow - ($storynum * $links);
$prevrow = ($check-$pagelinks-1) * $storynum;
if ($prevrow < 0)
{
$prevrow = 0;
}
echo("[ <a class=\"pn-normal\" href=\"modules.php?op=modload&name=News&file=index&catid=$catid&topic=$topic&startrow=0\" title=\""._PAGEBEGIN." "._PAGETEXT."\">"._PAGEBEGIN."</a> ] ");
echo("[ <a class=\"pn-normal\" href=\"modules.php?op=modload&name=News&file=index&catid=$catid&topic=$topic&startrow=$prevrow\" title=\""._PAGEPREVTEXT." $links "._PAGETEXTS."\">"._PAGEPREV."</a> ] ");
}
// Print the next pages, first check if there are more pages then 1
if ($pages >= 1)
{
$loop = 0;
$end_page_links = $check + $pagelinks - 1;
if ($end_page_links > $pages)
{
$loop = $pages;
$o = $check;
}
else
{
$loop = $end_page_links;
$o = $check;
}
for ($i=$o; $i <= $loop; $i++)
{ // Begin loop
$nextrow = $storynum * ($i - 1);
//Check for current page - if it is: do not put a link
if($cur_page == $i)
{
echo(" <b>$i</b> ");
}
else
{
$title = ucfirst(_PAGETEXT)." $i";
echo(" <a class=\"pn-normal\" href=\"modules.php?op=modload&name=News&file=index&catid=$catid&topic=$topic&startrow=$nextrow\" title=\"$title\">$i</a> ");
}
}
}
//End loop
// Check if we are at the last page, if so, dont print 'Next'
if ( ($pages > ($check + $pagelinks - 1)) && $pages != 1 && ($num_record > 1))
{
// not the last page so print Next $links pages
$nextrow = $storynum * ($check + $pagelinks - 1);
echo("[ <a class=\"pn-normal\" href=\"modules.php?op=modload&name=News&file=index&catid=$catid&topic=$topic&startrow=$nextrow\" title=\""._PAGENEXTTEXT." $links "._PAGETEXTS."\">"._PAGENEXT."</a> ] ");
echo("[ <a class=\"pn-normal\" href=\"modules.php?op=modload&name=News&file=index&catid=$catid&topic=$topic&startrow=$last\" title=\""._PAGEEND." "._PAGETEXT."\">"._PAGEEND."</a> ]");
}
echo("<br><br>");
}
