Changeset 6 for branches/2/index.php


Ignore:
Timestamp:
May 8, 2008, 8:48:00 PM (16 years ago)
Author:
george
Message:

Přidáno: Zobrazení prvních textů v seznamu položek ve skupinách.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2/index.php

    r5 r6  
    5050    return($out);
    5151  }
     52
     53  function PagesList($URL, $Page, $TotalCount, $CountPerPage)
     54  {
     55    $Count = ceil($TotalCount / $CountPerPage);
     56    $Around = 10;
     57    $Result = '';
     58    if($Count > 1)
     59    {
     60      if($Page > 0)
     61      {
     62        $Result .= '<a href="'.$URL.'0">&lt;&lt;</a> ';
     63        $Result .= '<a href="'.$URL.($Page - 1).'">&lt;</a> ';
     64      }
     65      $PagesMax = $Count - 1;
     66      $PagesMin = 0;
     67      if($PagesMax > ($Page + $Around)) $PagesMax = $Page + $Around;
     68      if($PagesMin < ($Page - $Around))
     69      {
     70        $Result .= ' .. ';
     71        $PagesMin = $Page - $Around;
     72      }
     73      for($i = $PagesMin; $i <= $PagesMax; $i++)
     74      {
     75        if($i == $Page) $Result .= '<strong>';
     76        $Result .= '<a href="'.$URL.$i.'">'.($i + 1).'</a> ';
     77        if($i == $Page) $Result .= '</strong>';
     78      }
     79      if($PagesMax < ($Count - 1)) $Result .= ' .. ';
     80      if($Page < ($Count - 1))
     81      {
     82        $Result .= '<a href="'.$URL.($Page + 1).'">&gt;</a> ';
     83        $Result .= '<a href="'.$URL.($Count - 1).'">&gt;&gt;</a>';
     84      }
     85    }
     86    return($Result);
     87  }
    5288}
    5389
Note: See TracChangeset for help on using the changeset viewer.