1
Draven
NewBB bug (Who thought of this?)
  • 2003/10/28 16:39

  • Draven

  • Module Developer

  • Posts: 337

  • Since: 2003/5/28


This is just a silly bug and is a design flaw. I just finished redoing a XOOPS site that has a very large user base and busy forums. In the viewforums.php file there's a section for "paginating" that adds "..." between every three pages. Well if a thread has 96 pages (as one of mine does) it adds 33 "..." and blows the page apart.

This:
if ( $totalpages > 1 ) {
        
$pagination .= '&nbsp;&nbsp;&nbsp;<img src="'.XOOPS_URL.'/images/icons/posticon.gif" /> ';
        for ( 
$i = 1; $i <= $totalpages; $i++ ) {

            if ( 
$i > 3 && $i < $totalpages ) {
                
$pagination .= "...";
            } else {
                
$addlink = '&start='.(($i - 1) * $forumdata['posts_per_page']);
                
$pagination .= '[<a href="'.$topiclink.$addlink.'">'.$i.'</a>]';
            }
        }
    }

Should be:

if ( $totalpages > 1 ) {
        
$pagination .= '&nbsp;&nbsp;&nbsp;<img src="'.XOOPS_URL.'/images/icons/posticon.gif" /> ';
        
$setdots = 0;
        for ( 
$i = 1; $i <= $totalpages; $i++ ) {


                        
// Hacked by Draven
            
if ( $i > 3 && $i < $totalpages) {
                if(
$setdots == 0){
                    
$pagination .= "...";
                    
$setdots = 1; 
                }
                        
// -- End Hack
                
            
} else {
                
$addlink = '&start='.(($i - 1) * $forumdata['posts_per_page']);
                
$pagination .= '[<a href="'.$topiclink.$addlink.'">'.$i.'</a>]';
            }
        }
    }

This isn't a beautiful fix, but it works.