$var,get_object_vars($this)))
$this->$var=$value;
else {
$this->error(__FUNCTION__,$var." does not belong to PB_Page!");
}
}
/**
* 打开倒AJAX模式
*
* @param string $action 默认ajax触发的动作。
*/
function open_ajax($action)
{
$this->is_ajax=true;
$this->ajax_action_name=$action;
}
/**
* 获取显示""的代码
*
* @param string $style
* @return string
*/
function next_page($style='''')
{
if($this->nowindex<$this->totalpage){
return $this->_get_link($this->_get_url($this->nowindex+1),$this->next_page,$style);
}
return ''<span class=".$style.">''.$this->next_page.''</span>'';
}
/**
* 获取显示“”的代码
*
* @param string $style
* @return string
*/
function pre_page($style='''')
{
if($this->nowindex>1){
return $this->_get_link($this->_get_url($this->nowindex-1),$this->pre_page,$style);
}
return ''<span class=".$style.">''.$this->pre_page.''</span>'';
}
/**
* 获取显示“首页”的代码
*
* @return string
*/
function first_page($style='''')
{
if($this->nowindex==1){
return ''<span class=".$style.">''.$this->first_page.''</span>'';
}
return $this->_get_link($this->_get_url(1),$this->first_page,$style);
}
/**
* 获取显示“尾页”的代码
*
* @return string
*/
function last_page($style='''')
{
if($this->nowindex==$this->totalpage){
return ''<span class=".$style.">''.$this->last_page.''</span>'';
}
return $this->_get_link($this->_get_url($this->totalpage),$this->last_page,$style);
}
function nowbar($style='''',$nowindex_style='''')
{
$plus=ceil($this->pagebarnum/2);
if($this->pagebarnum-$plus+$this->nowindex>$this->totalpage)$plus=($this->pagebarnum-$this->totalpage+$this->nowindex);
$begin=$this->nowindex-$plus+1;
$begin=($begin>=1)?$begin:1;
$return='''';
for($i=$begin;$i<$begin+$this->pagebarnum;$i++)
{
if($i<=$this->totalpage){
if($i!=$this->nowindex)
$return.=$this->_get_text($this->_get_link($this->_get_url($i),$i,$style));
else
$return.=$this->_get_text(''<span class=".$nowindex_style.">''.$i.''</span>'');
}else{
break;
}
$return.="\n";
}
unset($begin);
return $return;
}
/**
* 获取显示跳转按钮的代码
*
* @return string
*/
function select()
{
$return=''<select name="PB_Page_Select">'';
for($i=1;$i<=$this->totalpage;$i++)
{
if($i==$this->nowindex){
$return.=''<option value="''.$i.''" selected>''.$i.''</option>'';
}else{
$return.=''<option value="''.$i.''">''.$i.''</option>'';
}
}
unset($i);
$return.=''</select>'';
return $return;
}
/**
* 获取mysql 语句中limit需要的值
*
* @return string
*/
function offset()
{
return $this->offset;
}
/**
* 控制分页显示风格
*
* @param int $mode
* @return string
*/
function show($mode=1)
{
switch ($mode)
{
case ''1'':
$this->next_page='''';
$this->pre_page='''';
return $this->pre_page().$this->nowbar().$this->next_page().''第''.$this->select().''页'';
break;
case ''2