RSS 2.0 Feed

» Welcome Guest Log In :: Register

Pages: (52) < [1] 2 3 4 5 6 ... >   
  Topic: Board Mechanics< Next Oldest | Next Newest >  
Wesley R. Elsberry



Posts: 4991
Joined: May 2002

(Permalink) Posted: May 12 2006,18:45   

Here's the code that generates the page links on the forum display page. I'm willing to experiment if someone wants to take a shot at code to also display the links to the final three pages when there are more than seven pages total.

Quote


   my $Pages = ($topic->{'TOPIC_POSTS'} + 1) / $iB::INFO->{'DISPLAY_MAX_POSTS'};
   my ($Int, $Dec) = split /\./,$Pages;
   $Dec > 0 ? ($Pages = $Int + 1) : ($Pages = $Int);
   $Pages = 1 if $Pages < 1;
   if ($Pages > 1) {
       $topic->{'PAGES'} = qq[<span id="small">($Forum::lang->{topic_sp_pages} ];
       my $i = 0;
       for(0 .. $Pages-1) {
           my $RealNo = $i * $iB::INFO->{'DISPLAY_MAX_POSTS'}; my $PageNo = $i + 1;
           if ($PageNo == 4) { $topic->{'PAGES'} .= qq[<a href='$iB::INFO->{'BOARD_URL'}/ikonboard.$iB::INFO->{'CG\
I_EXT'}?s=$iB::SESSION;act=ST;f=$iB::IN{'f'};t=$topic->{'TOPIC_ID'};st=] . ($Pages - 1) * $iB::INFO->{'DISPLAY_MAX_\
POSTS'} . qq['>..$Pages </a>]; last; }
           $topic->{'PAGES'} .= qq[<a href='$iB::INFO->{'BOARD_URL'}/ikonboard.$iB::INFO->{'CGI_EXT'}?s=$iB::SESSI\
ON;act=ST;f=$iB::IN{'f'};t=$topic->{'TOPIC_ID'};st=$RealNo'>$PageNo </a>];
           ++$i;
       }
       $topic->{'PAGES'} .= qq[)</span>];
   }



Note that for topics with 4 or more pages, it simply terminates with linking to the final page. That's what "last" does in Perl as a command.

--------------
"You can't teach an old dogma new tricks." - Dorothy Parker

    
  1545 replies since Oct. 19 2005,12:45 < Next Oldest | Next Newest >  

Pages: (52) < [1] 2 3 4 5 6 ... >   


Track this topic Email this topic Print this topic

[ Read the Board Rules ] | [Useful Links] | [Evolving Designs]