Ver Mensaje Individual
  #50 (permalink)  
Antiguo 25/11/2011, 12:03
bbrian
 
Fecha de Ingreso: enero-2010
Mensajes: 400
Antigüedad: 14 años, 3 meses
Puntos: 6
Respuesta: Paginacion de Resultados

Me dice esto con ese codigo:

* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ class kpaginate{ private $ends = 2 ; private $show = 10 ; private $num_pgs = 0 ; private $total_items = 0 ; private $items_pg = 0 ; private $pg = 0 ; private $prefix = 'kpg' ; private $start = 0 ; private $stop = 0 ; private $getvars = array() ; private $without_numbers = false ; private $customvar = '' ; public static $correlative = 0 ; function __construct(){ self::$correlative++ ; $this->getvars = $_GET ; } public function withoutNumbers($bool){ $this->without_numbers = $bool ; } public function getLimit(){ return array(($this->pg * $this->items_pg), $this->items_pg) ; } public function setTotalItems($total_items){ $this->total_items = intval($total_items) ; if($this->items_pg > 0){ $this->setNumPages() ; if($this->customvar != '') $this->setCustomPage() ; else $this->setPage($this->getvars[$this->prefix][self::$correlative]) ; } } public function setItemsPerPage($items_pg){ $this->items_pg = intval($items_pg) ; if($this->total_items > 0){ $this->setNumPages() ; if($this->customvar != '') $this->setCustomPage() ; else $this->setPage($this->getvars[$this->prefix][self::$correlative]) ; } } private function setNumPages(){ $this->num_pgs = ceil($this->total_items / $this->items_pg) ; } private function setCustomPage(){ $pg = 0 ; $getstr = '' ; parse_str($this->customvar, $ctmout) ; while(is_array($ctmout)){ $getstr .= '[\'' . current(array_keys($ctmout)) . '\']' ; $ctmout = current(array_values($ctmout)) ; } eval('$pg = intval($this->getvars' . $getstr . ') ; ') ; if($pg > 0 && $pg < $this->num_pgs) $this->pg = $pg ; else $this->pg = 0 ; } private function setPage($pg){ $pg = intval($pg) ; if($pg > 0 && $pg < $this->num_pgs) $this->pg = $pg ; else $this->pg = 0 ; } private function createPageLink($pg){ $pg = intval($pg) - 1 ; if($this->pg == $pg) return ' class="selected" ' ; if($this->customvar != ''){ $customurl = urldecode(http_build_query($this->getvars) . '&' . $this->customvar . '=' . $pg) ; parse_str($customurl, $urlout) ; $lnk = 'href="?' . urldecode(http_build_query($urlout)) . '"' ; } else{ $this->getvars[$this->prefix][self::$correlative] = $pg ; $lnk = 'href="?' . urldecode(http_build_query($this->getvars)) . '"' ; } return $lnk ; } public function setCustomVar($varname = ''){ if(trim($varname) != '') $this->customvar = trim(strval($varname)) ; } private function calculateBuffers(){ $this->left = $this->right = ceil($this->show / 2) ; $this->start = ($this->pg + 1) - $this->left ; $this->stop = ($this->pg + 1) + $this->right ; if($this->start < 1){ $this->start = 1 ; $this->stop = $this->show + 1 ; if($this->stop > $this->num_pgs) $this->stop = $this->num_pgs ; } if($this->stop > $this->num_pgs){ $this->stop = $this->num_pgs ; $this->start = ($this->stop - $this->show) ; if($this->start < 1) $this->start = 1 ; } $this->start += $this->ends ; $this->stop -= $this->ends ; } public function paginate(){ if($this->total_items > $this->items_pg){ echo '' ; echo '' ; if($this->without_numbers == false){ if($this->num_pgs <= $this->show){ for($i = 1 ; $i <= $this->num_pgs ; $i++) echo '' ; } else{ $this->calculateBuffers() ; for($i = 1 ; $i <= $this->ends ; $i++) echo '' ; if($i != $this->start) echo '' ; for($i = $this->start ; $i <= $this->stop ; $i++) echo '' ; if($i != ($this->num_pgs - ($this->ends - 1))) echo '' ; for($i = ($this->num_pgs - ($this->ends - 1)) ; $i <= $this->num_pgs ; $i++) echo '' ; } } echo '' ; echo '
pg > 0 ? $this->createPageLink($this->pg) . ' class="back" ' : ' class="backdis" ') . '> createPageLink($i) . ' class="normal">' . ($i) . ' createPageLink($i) . ' class="normal">' . ($i) . ' ... createPageLink($i) . ' class="normal">' . ($i) . ' ... createPageLink($i) . ' class="normal">' . ($i) . ' pg < $this->num_pgs - 1 ? $this->createPageLink($this->pg + 2) . ' class="next" ' : ' class="nextdis" ') . '>
' ; } } } ?>

y tira un error ( ! ) Fatal error: Class 'kpaginate' not found in C:\wamp\www\Suspension Norte\kpaginate.php on line 129

LINEA 129: $kpaginate = new kpaginate ;