perPage = $perPage; if (!empty($_GET[$this->getURL])) { $this->page = $_GET[$this->getURL]; } else { $this->page = 1; } $this->length = count($array); //total pageLinks generated, count(array) $this->pages = ceil($this->length / $this->perPage); // $this->start = ceil(($this->page - 1) * $this->perPage); return array_slice($array, $this->start, $this->perPage); } function getNumPages(){ if (count()) return FALSE; return ceil(mysql_num_rows($this->results) / (float)$this->pageSize); } function links(){ $plinks = array(); $links = array(); $slinks = array(); // Concatenate the get variables to add to the page numbering string if (count($_GET)) { $queryURL = ''; foreach ($_GET as $key => $value) { if (($key != $this->getURL)&&($key != 'mod')) { $queryURL .= '&'.$key.'='.$value; } } } if (($this->pages) > 1){ if ($this->page != 1) { if ($this->showFirstAndLast) { $plinks[] = '
«« First
'; } $plinks[] = '
« Prev
'; } // Create numLinks if(($this->numLinks=='all')||($this->numLinks<1)){ for ($j = 1; $j < ($this->pages + 1); $j++) { if ($this->page == $j) { $links[] = '
'.$j.'
'; } else { $links[] = '
'.$j.'
'; } } } else{ //retrieve from which set of block $block = ceil($this->page / $this->numLinks); // get the initial number of block $lLink = $block*$this->numLinks; // get the last number of block $fLink = $lLink-$this->numLinks; for ($j = $fLink+1; (($j <= $lLink) && ($j <= $this->pages)); $j++) { if ($this->page == $j) { $links[] = '
'.$j.'
'; } else { $links[] = '
'.$j.'
'; } } } if ($this->page < $this->pages) { $slinks[] = '
Next »
'; if ($this->showFirstAndLast) { $slinks[] = '
Last »»
'; } } return "
".implode(' ', $plinks).implode($this->implodeBy, $links).implode(' ', $slinks)."
"; } return; } } ?>