Wlasnie znalazlem na necie bardzo fajna klase do porcjowania wynikow.
Problem w niej polega na tym ze jak ta klase zaincluduje powiedzmy do pliku xx.php to linki do kolejnych stron wygladaja tak:
http://127.0.0.1/xx.php?p=3&order=id&pagesize=6
Zas jesli plik wywolam na strone z pliku index.php awierajacego takie cos:
[php:1:7afa2c87a6]
if(!isset($go)){
include("xx.php");}
else if($go==news){
include("xx.php");} [/php:1:7afa2c87a6]
to link wyglada tak samo jak powyzej a ja hcialbym z pewnych wzgledow aby link wyglad tak: http://127.0.0.1/?go=news&p=3&order=id&pagesize=6
Czy da sie zmodyfikowac te klase aby w taki sposob plik w ktorym ja zainkluduje generowal linki


Gdyz ten sam plik klasy chce wykorzystac do wielu skryptow.
Ponadto co znacza w tym skrypcie linijki od 11-18


clasa.php
[php:1:7afa2c87a6]<?php
/**
* A Class use to Mysql page
*
* @author Avenger <avenger@php.net>
* @version 1.02
* @update 2003-04-27 23:11:29
*
*
* Useage:
* $p = new show_page; // Create the Object
* $p->file="ttt.php"; // Set used the class name,default to the PHP_SELF
* $p->pvar="pagecount"; // Set the page parameter,default to "p"
* $p->setvar(array("a" => '1', "b" => '2')); // Set the parameter u wanta pass, Note:used it above the $p->set
* $p->set(20,2000,1); // Set the object parameter,total 3,1st is the pagesize,2nd is the total record count,3rd is the currerent page count,default is will auto read the GET variable
* $p->output(0); // Output,the parameter is true will return a string
* echo $p->limit(0); // Out put the limit.eg. "SELECT * FROM TABLE LIMIT {$p->limit()}"; set it true,will return a array
*
*/
class show_page {
var $output;
var $file;
var $pvar = "p";
var $psize;
var $curr;
var $varstr;
var $tpage;
/**
* page set
*
* @access public
* @param int $pagesize The pagesize
* @param int $total The toal records count
* @param int $current Current page,keep empty will auto read the get variable
* @return void
*/
function set($pagesize=20,$total,$current=false) {
global $HTTP_SERVER_VARS,$HTTP_GET_VARS;
$this->tpage = ceil($total/$pagesize);
if (!$current) {$current = $HTTP_GET_VARS[$this->pvar];}
if ($current>$this->tpage) {$current = $this->tpage;}
if ($current<1) {$current = 1;}
$this->curr = $current;
$this->psize = $pagesize;
if (!$this->file) {
$this->file = $HTTP_SERVER_VARS['PHP_SELF'];
}
strstr($this->file,'?') ? $middle = '&' : $middle = '?';
if ($this->tpage > 1) {
if ($current>10) {
$this->output.='<a class="menu" href='.$this->file.$middle.$this->pvar.'='.($current-10).($this->varstr).' title="Previous 10"><<<</a> ';
}
if ($current>1) {
$this->output.='<a class="menu" href='.$this->file.$middle.$this->pvar.'='.($current-1).($this->varstr).' title="Previous">prewiu</a> ';
}
$start = floor($current/10)*10;
$end = $start+9;
if ($start<1) $start=1;
if ($end>$this->tpage) $end=$this->tpage;
for ($i=$start; $i<=$end; $i++) {
if ($current==$i) {
$this->output.='<b><font color="black" class="menu2">'.$i.'</font></b> ';
} else {
$this->output.='<a class="menu" href="'.$this->file.$middle.$this->pvar.'='.$i.$this->varstr.'">['.$i.']</a> ';
}
}
if ($current<$this->tpage) {
$this->output.='<a class="menu" href='.$this->file.$middle.$this->pvar.'='.($current+1).($this->varstr).' title="Next">>></a> ';
}
if ($this->tpage>10 && ($this->tpage-$current)>=10 ) {
$this->output.='<a class="en1" href='.$this->file.$middle.$this->pvar.'='.($current+10).($this->varstr).' title="Next 10">>>></a>';
}
}
}
/**
* passed variable set
*
* @access public
* @param array $data The parameter u wanta passed,see the example above.
* @return void
*/
function setvar($data) {
foreach ($data as $k=>$v) {
$this->varstr.='&'.$k.'='.urlencode($v);
}
}
/**
* Output
*
* @access public
* @param bool $return Set it true will return a string,otherwish will output automatic
* @return string
*/
function output($return = false) {
if ($return) {
return $this->output;
} else {
echo $this->output;
}
}
/**
* Make the limit
*
* @access public
* @return string
*/
function limit($arr=0) {
if ($arr) {
settype($arr,"array");
$arr[1] = ($this->curr-1)*$this->psize;
$arr[2] = $this->psize;
return $arr;
} else {
return (($this->curr-1)*$this->psize).','.$this->psize;
}
}
} //End Class
?> [/php:1:7afa2c87a6][/img]