[ PHPXref.com ] [ Generated: Sun Jul 20 20:25:38 2008 ] [ SPiD 1.3.1 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> browse.php (source)

   1  <?
   2          // Browsing
   3          
   4          // left arrow
   5          if ($base != 1) {
   6              $newbase_arrow1 = $base - $num;
   7              if ($newbase_arrow1 < 1) { $newbase_arrow1 = 1; }
   8              print "<a href=\"spid.php?cat=$cat&amp;order=$order&amp;tri=$tri&amp;base=$newbase_arrow1&amp;num=$num&amp;lang=$lang&amp;theme=$theme\">\n";
   9              print "<img src=\"$spid_theme_fl_gauche\" alt=\"previous\" border=\"0\" /></a>\n";
  10          }
  11          
  12          // in between
  13          $page = (ceil ($base / $num));
  14          $maxpage = (ceil ($max / $num));
  15          $end = ($base + $num) - 1;
  16          
  17          print "($lang_string_view $base-";
  18          if ($end > $max) { print "$max $lang_string_on $max) ["; }
  19          else { print "$end $lang_string_on $max) ["; }
  20          
  21          // first page
  22          if ($page == 1) {
  23              print "<b>1</b> ";
  24              for ($i_page = 1; $i_page < 5; $i_page++) {    
  25                  $newbase_page = $base + ($num * $i_page);
  26                  if ($newbase_page <= $max) {
  27                      $mypage = $page + $i_page;
  28                      print "<a href=\"spid.php?cat=$cat&amp;order=$order&amp;tri=$tri&amp;base=$newbase_page&amp;num=$num&amp;lang=$lang&amp;theme=$theme\" class=\"link\">\n";
  29                      print "$mypage</a> ";
  30                  }
  31              }
  32          }
  33          // second page
  34          elseif ($page == 2) {
  35              print "<a href=\"spid.php?cat=$cat&amp;order=$order&amp;tri=$tri&amp;base=1&amp;num=$num&amp;lang=$lang&amp;theme=$theme\" class=\"link\">";
  36              print "1</a> <b>$page</b> ";
  37              for ($i_page = 1; $i_page <=3; $i_page++) {    
  38                  $newbase_page = $base + ($num * $i_page);
  39                  if ($newbase_page <= $max) {
  40                      $mypage = $page + $i_page;
  41                      print "<a href=\"spid.php?cat=$cat&amp;order=$order&amp;tri=$tri&amp;base=$newbase_page&amp;num=$num&amp;lang=$lang&amp;theme=$theme\" class=\"link\">\n";
  42                      print "$mypage</a> ";
  43                  }
  44              }
  45              
  46          }
  47          // not quite last page
  48          elseif ($page == ($maxpage - 1)) {
  49              for ($i_page = 1; $i_page <= 5; $i_page++) {
  50                  if ($i_page == 1) { $diff = -3; }
  51                  if ($i_page == 2) { $diff = -2; }
  52                  if ($i_page == 3) { $diff = -1; }
  53                  if ($i_page == 4) { $diff = 0; }
  54                  if ($i_page == 5) { $diff = 1; }
  55                  $newbase_page = $base + ($num * $diff);
  56                  $mypage = $page + $diff;
  57                  
  58                  if (($mypage > 1) && ($i_page == 1)) { print ".. "; }
  59                  else { print " "; }
  60                  
  61                  if ($diff == 0) { print " <b>$mypage</b> "; }
  62                  elseif (($newbase_page <= $max) && ($newbase_page > 0)) {
  63                      print "<a href=\"spid.php?cat=$cat&amp;order=$order&amp;tri=$tri&amp;base=$newbase_page&amp;num=$num&amp;lang=$lang&amp;theme=$theme\" class=\"link\">\n";
  64                      print "$mypage</a> ";
  65                  }
  66              }    
  67          }    
  68          // previous last -don't know the word... :)- page
  69          elseif ($page == $maxpage) {
  70              for ($i_page = 1; $i_page <= 5; $i_page++) {
  71                  if ($i_page == 1) { $diff = -4; }
  72                  if ($i_page == 2) { $diff = -3; }
  73                  if ($i_page == 3) { $diff = -2; }
  74                  if ($i_page == 4) { $diff = -1; }
  75                  if ($i_page == 5) { $diff = 0; }
  76                  $newbase_page = $base + ($num * $diff);
  77                  $mypage = $page + $diff;
  78                  
  79                  if (($mypage > 1) && ($i_page == 1)) { print ".. "; }
  80                  else { print " "; }
  81          
  82                  if ($diff == 0) { print " <b>$mypage</b> "; }
  83                  elseif (($newbase_page <= $max) && ($newbase_page > 0)) {
  84                      print "<a href=\"spid.php?cat=$cat&amp;order=$order&amp;tri=$tri&amp;base=$newbase_page&amp;num=$num&amp;lang=$lang&amp;theme=$theme\" class=\"link\">\n";
  85                      print "$mypage</a> ";
  86                  }
  87              }    
  88          }    
  89          // Every other page
  90          else {
  91              for ($i_page = 1; $i_page <= 5; $i_page++) {
  92                  if ($i_page == 1) { $diff = -2; }
  93                  if ($i_page == 2) { $diff = -1; }
  94                  if ($i_page == 3) { $diff = 0; }
  95                  if ($i_page == 4) { $diff = 1; }
  96                  if ($i_page == 5) { $diff = 2; }
  97                  $newbase_page = $base + ($num * $diff);
  98                  $mypage = $page + $diff;
  99                  
 100                  if (($mypage > 1) && ($i_page == 1)) { print ".. "; }
 101                  else { print " "; }
 102                  
 103                  if ($diff == 0) { print " <b>$mypage</b> "; }
 104                  elseif ($newbase_page <= $max) {
 105                      print "<a href=\"spid.php?cat=$cat&amp;order=$order&amp;tri=$tri&amp;base=$newbase_page&amp;num=$num&amp;lang=$lang&amp;theme=$theme\" class=\"link\">\n";
 106                      print "$mypage</a> ";
 107                  }
 108              }    
 109          }
 110          if (($newbase_page + $num) <= $max) { print ".."; }    
 111          print "]\n";
 112                  
 113          // right arrow
 114          if ($end < $max) {
 115              $newbase_arrow2 = $end + 1;
 116              print "<a href=\"spid.php?cat=$cat&amp;order=$order&amp;tri=$tri&amp;base=$newbase_arrow2&amp;num=$num&amp;lang=$lang&amp;theme=$theme\">\n";
 117              print "<img src=\"$spid_theme_fl_droite\" alt=\"next\" border=\"0\"  /></a>\n";
 118          }
 119  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]