class PageBar
{
var $total;
var $onepage;
var $num;
var $pagecount;
var $total_page;
var $offset;
var $linkhead;
function PageBar($total, $onepage, $pagecount, $form_vars='')
{
$this->total = $total;
$this->onepage = $onepage;
$this->pagecount = $pagecount;
$this->total_page = ceil($total/$onepage);
if (empty($pagecount))
{
$this->pagecount = 1;
$this->offset = 0;
}
else
{
$this->pagecount = $pagecount;
$this->offset = ($pagecount-1)*$onepage;
}
if (!empty($form_vars))
{
$vars = explode("|", $form_vars);
$chk = $vars[0];
$chk_value = $_POST['$chk'];
if (empty($chk_value))
{
$formlink = "";
}
else
{
for ($i=0; $ilinkhead = $_SERVER['PHP_SELF']."?".$formlink;
}
else
{
$this->linkhead = $_SERVER['PHP_SELF']."?".$linkft.$formlink;
}
}
#End function PageBar();
function offset()
{
return $this->offset;
}
#End function offset();
function pre_page($char='')
{
$linkhead = $this->linkhead;
$pagecount = $this->pagecount;
$web_lg = $this->web_lg;
if (empty($char))
{
$p_page = 'Preview Page';
$char = iconv("Big5","utf-8",$p_page);
}
if ($pagecount>1)
{
$pre_page = $pagecount - 1;
return "$char";
}
else
{
return ' ';
}
}
#End function pre_page();
function next_page($char='')
{
$linkhead = $this->linkhead;
$total_page = $this->total_page;
$pagecount = $this->pagecount;
$web_lg = $this->web_lg;
if (empty($char))
{
$p_page = 'Next Page';
$char = iconv("Big5","utf-8",$p_page);
}
if ($pagecount<$total_page)
{
$next_page = $pagecount + 1;
return "$char";
}
else
{
return ' ';
}
}
#End function next_page();
function num_bar($num='', $color='', $left='', $right='')
{
$num = (empty($num))?10:$num;
$this->num = $num;
$mid = floor($num/2);
$last = $num - 1;
$pagecount = $this->pagecount;
$totalpage = $this->total_page;
$linkhead = $this->linkhead;
$left = (empty($left))?" [ ":$left;
$right = (empty($right))?" ] ":$right;
$color = (empty($color))?"#ff0000":$color;
$minpage = (($pagecount-$mid)<1)?1:$pagecount-$mid;
$maxpage = $minpage + $last;
if ($maxpage>$totalpage)
{
$maxpage = $totalpage;
$minpage = $maxpage - $last;
$minpage = ($minpage<1)?1:$minpage;
}
for ($i=$minpage; $i<=$maxpage; $i++)
{
$char = $left.$i.$right;
if ($i==$pagecount)
{
$char = "$char";
}
/*
echo "";
*/
$linkchar = "".$char."";
$linkbar = $linkbar.$linkchar;
}
if($maxpage <= 1)
{
}
else
{
return $linkbar;
}
}
#End function num_bar();
function whole_num_bar($num='', $color='')
{
$num_bar = $this->num_bar($num, $color);
$pre_page = $this->pre_page();
$next_page = $this->next_page();
return $pre_group.$pre_page.$num_bar.$next_page.$next_group;
}
#End function whole_bar();
}
#End class PageBar;
?> Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\xampp\htdocs\lite\basefile.php on line 108
Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\xampp\htdocs\lite\basefile.php on line 108
Fatal error: Class 'PageBar' not found in C:\xampp\htdocs\lite\product.php on line 21