Pages: [1]
Tags: 039 ENGLISH ALT AMP APP AS1 BOARD1 CGI ENDPAGE FORUMLINK FORUMTEXT GIF IMAGESURL IMG INT JAVASCRYPT JPG LASTPN LASTPTN MAX MAXHITS MESAGEINDEX MNUM MSG MULTIPAGE NNN NUM NUMERIAI NUMERIAI1 NUMERIS NUMERUKAS ONCLICK PAGEDROPINDEX1 PAGEDROPINDEX2 PAGETEXTINDEX PAGETXTINDEX PIRMU POSTDISPLAYNUM QUOT SRC STARTPAGE STRT TMPA UPLOADS VIENS VIEWC VIEWNUM ZALIAS7
  Author: Topic: forum pages count
offline zalias7
Last Visit: 09/20/11

Level 1
Joined: 12/15/10
Forum Posts: 3
 forum pages count
 Posted on: 01/03/11 at 16:29:50

Immediately Sorry for my bad English.

When me the forum pages is as follows:


Image URLX2    Image URLX4

I did, that would be as follows:

Image URLX2    Image URLX4

code from the forum/display.pl

code:
   print_top();
   my $pages = qq~<span class="forumtext">  <b><u>$msg{'039'}</u></b> </span>~;
   $nummessages = @messages;
   $c = 0;
   while (($c*$maxmessagedisplay) < $nummessages) {
      $viewc = $c+1;
      $strt = ($c*$maxmessagedisplay);
      if ($start == $strt) { $pages .= "[$viewc] "; }
      else { $pages .= qq~<a
href="$forum&op=$display&num=$viewnum&start=$strt">$viewc</a> ~;
      }
      $c++;
   }



change to:


code:
   print_top();
   my $pages = qq~<span class="forumtext">  <b><u>$msg{'039'}</u></b> </span>~;
   $nummessages = @messages;
   $pages=$pages.viens_du($nummessages,$maxmessagedisplay,0,$start,$viewnum);
#   $c = 0;
#   while (($c*$maxmessagedisplay) < $nummessages) {
#      $viewc = $c+1;
#      $strt = ($c*$maxmessagedisplay);
#      if ($start == $strt) { $pages .= "[$viewc] "; }
#      else { $pages .= qq~<a
# href="$forum&op=$display&num=$viewnum&start=$strt">$viewc</a> ~;
#      }
#      $c++;
#   }



and add sub to forum_subs.pl

code:
sub viens_du {
my ($maxhits_1,$maxdisplay,$su_pirmu,$nh,$numeris) =@_;

   # Build the page links list.
$mreplies=$maxhits_1;$start=$nh;$maxmessagedisplay=$maxdisplay;
   my ($pagetxtindex, $pagetextindex, $pagedropindex1, $pagedropindex2, $all, $allselected);

   $postdisplaynum = 5;               # max number of pages to display
   $startpage = 0;
   $max = $mreplies;
   $start = $start > $mreplies ? $mreplies : $start;
   
   $start = (int($start / $maxmessagedisplay)) * $maxmessagedisplay;
   $tmpa = 1;

$as1=($nh/$maxdisplay)+1;
   if ($start >= (($postdisplaynum - 1) * $maxmessagedisplay)) {
      $startpage = $start - (($postdisplaynum - 1) * $maxmessagedisplay);
      $tmpa = int($startpage / $maxmessagedisplay) + 1;
   }

   if ($max >= $start + ($postdisplaynum * $maxmessagedisplay)) { $endpage = $start + ($postdisplaynum * $maxmessagedisplay); } else { $endpage = $max; } #{$endpage=$start +  $maxmessagedisplay;}
   $lastpn = int($mreplies / $maxmessagedisplay) == $mreplies / $maxmessagedisplay ? ($mreplies / $maxmessagedisplay): int($mreplies / $maxmessagedisplay)+1;
   $lastptn = ($lastpn - 1) * $maxmessagedisplay;

         for ($counter = $startpage; $counter < $endpage; $counter += $maxmessagedisplay) {

$numerukas=($tmpa*$maxmessagedisplay)-$maxmessagedisplay;
$pagetxtindex .= $tmpa == $as1 && !$su_pirmu ? qq~<b>$tmpa</b> ~ : qq~<a href="$forum&op=display&num=$numeris&start=$numerukas" class="forumlink">$tmpa</a> ~;
            $tmpa++;
         }
$aa="";$cc="";
         if ($endpage < $max - $maxmessagedisplay) {
            $pagetxtindex .= qq~<a href="javascript:void(0);" onclick="ListPages(0);">...</a> ~;
$aa=int(($max-$endpage)/$maxmessagedisplay);
$bb= $postdisplaynum <=$aa  ? $postdisplaynum -1: $aa-1;

for($ii=$lastpn-$bb;$ii<$lastpn;$ii++) {
$nnn = ($ii*$maxmessagedisplay)-$maxmessagedisplay;
$pagetxtindex .=qq~<a href="$forum&op=display&num=$numeris&start=$nnn" class="forumlink">$ii</a> ~;
   }
            }

         if ($endpage != $max) {$pagetxtindex .=qq~<a href="$forum&op=display&num=$numeris&start=$lastptn" class="forumlink">$lastpn</a> ~;}
return qq($pagetxtindex);
}



forum topic when it becomes very large, they are starting to look as follows:


Image URLX2    Image URLX4

replace code (cgi-lib/forum.pl (sub mesageindex))


code:
      $nummessages = $mreplies[$b]+1;
      if ($nummessages > $maxmessagedisplay) {
         $c = 0;   my ($viewc, $strt);
      while (($c*$maxmessagedisplay) < $nummessages) {
$viewc = $c+1;$strt = $c*$maxmessagedisplay;
      $pages .= qq~<a href="$forum&op=display&num=$mnum[$b]&start=$strt" class="forumlink">$viewc</a> ~;
      $c++;
         }
         $pages = qq~( <img src="$imagesurl/forum/multipage.gif" alt=""> $pages )~;
      }



to


code:
      my $pages = '';
      $nummessages = $mreplies[$b]+1;
$pages=viens_du($nummessages,$maxmessagedisplay,1,$start,$mnum[$b],0);   
#      if ($nummessages > $maxmessagedisplay) {
#         $c = 0;   my ($viewc, $strt);
#         while (($c*$maxmessagedisplay) < $nummessages) {
#$viewc = $c+1;$strt = $c*$maxmessagedisplay;
#      $pages .= qq~<a href="$forum&op=display&num=$mnum[$b]&start=$strt" class="forumlink">$viewc</a> ~;
#      $c++;
#         }
#         $pages = qq~( <img src="$imagesurl/forum/multipage.gif" alt=""> $pages )~;
#      }



then looks like this forum:


Image URLX2    Image URLX4

I am happy to link to your :)



My generic signature...
Logged
     
offline On
Last Visit: 04/18/13

Administrator
Dev
Joined: 06/19/03
Forum Posts: 5018
 Re: forum pages count
 Posted on: 01/04/11 at 23:11:38

Very nice hack! congratulate

It should be added to the main code.



[user:On]
on@web-app.net

GC/CS/E/H/IT/L/M/MU/PA/P/S/SS/TW/O d(+++)>+ s: a+>++>+++$ C++++$ UBAHS*++++$ P+++++(--)$ L !E? W+>++ N+++@ K+++>++++++@ w$ !O M->+ V--() PS+(-) PE(++) Y+ PGP->+ t+() 5 X? R>* tv@ b++>+++ DI+++ D? G(-) e++>+++@ h----() r+++ y++++ (Words of wisdom from Larry Wall, 1993)
Logged
       
offline zalias7
Last Visit: 09/20/11

Level 1
Joined: 12/15/10
Forum Posts: 3
 Re: forum pages count
 Posted on: 01/05/11 at 17:13:37

Thank you:)
function names can overwrite better English.
Forum for users and I've moved on PostgreSQL, Would you be interested?



My generic signature...
Logged
     
offline On
Last Visit: 04/18/13

Administrator
Dev
Joined: 06/19/03
Forum Posts: 5018
 Re: forum pages count
 Posted on: 02/07/11 at 21:59:02


zalias7 said 2 days and 4 hours ago.:
Forum for users and I've moved on PostgreSQL, Would you be interested?



Sounds very interesting!



[user:On]
on@web-app.net

GC/CS/E/H/IT/L/M/MU/PA/P/S/SS/TW/O d(+++)>+ s: a+>++>+++$ C++++$ UBAHS*++++$ P+++++(--)$ L !E? W+>++ N+++@ K+++>++++++@ w$ !O M->+ V--() PS+(-) PE(++) Y+ PGP->+ t+() 5 X? R>* tv@ b++>+++ DI+++ D? G(-) e++>+++@ h----() r+++ y++++ (Words of wisdom from Larry Wall, 1993)
Logged
       
offline zalias7
Last Visit: 09/20/11

Level 1
Joined: 12/15/10
Forum Posts: 3
 Re: forum pages count
 Posted on: 02/14/11 at 07:14:29

When I finish processing the SE version 1.0 V, we will send you, but if you want. to operate and txt version, we need more work:)



My generic signature...
Logged
     

  forum pages count
  Mods Discussion and Support
  Forums
  
Pages: [1]
Hop to: