|
今天来发一个uri传递多个参数的方法
是小弟我自个研究的,方法很简单.老大们赐教!
直接修改 system\libraries\Pagination.php 文件
从183行开始修改:
PHP复制代码 // 我加的多个参数链接的方法-------
$Uristr = '';
$URLStr = count(explode('/',$_SERVER['REQUEST_URI']));
$URLArray = explode('/',$_SERVER['REQUEST_URI']);
$URLConfig = count(explode('/',$this->base_url));
//print_r($URLStr);
if($URLStr>=$URLConfig){
for($i=$URLConfig+1;$i<=$URLStr;$i++){
$Uristr.= "/".$URLArray[$i-1];
}
}
// Render the "First" link
if ($this->cur_page > ($this->num_links + 1))
{
$output .= $this->first_tag_open.'<a href="'.$this->base_url.$Uristr.'">'.$this->first_link.'</a>'.$this->first_tag_close;
}
// Render the "previous" link
if ($this->cur_page != 1)
{
$i = $uri_page_number - $this->per_page;
if ($i == 0) $i = 0;
$output .= $this->prev_tag_open.'<a href="'.$this->base_url.$i.$Uristr.'">'.$this->prev_link.'</a>'.$this->prev_tag_close;
}
// Write the digit links
for ($loop = $start -1; $loop <= $end; $loop++)
{
$i = ($loop * $this->per_page) - $this->per_page;
if ($i >= 0)
{
if ($this->cur_page == $loop)
{
$output .= $this->cur_tag_open.$loop.$this->cur_tag_close; // Current page
}
else
{
$n = ($i == 0) ? 0 : $i;
$output .= $this->num_tag_open.'<a href="'.$this->base_url.$n.$Uristr.'">'.$loop.'</a>'.$this->num_tag_close;
}
}
}
// Render the "next" link
if ($this->cur_page < $num_pages)
{
$output .= $this->next_tag_open.'<a href="'.$this->base_url.($this->cur_page * $this->per_page).$Uristr.'">'.$this->next_link.'</a>'.$this->next_tag_close;
}
// Render the "Last" link
if (($this->cur_page + $this->num_links) < $num_pages)
{
$i = (($num_pages * $this->per_page) - $this->per_page);
$output .= $this->last_tag_open.'<a href="'.$this->base_url.$i.$Uristr.'">'.$this->last_link.'</a>'.$this->last_tag_close;
} 复制代码
接下来就可以 /Article/page/15/5/5/6/7/8 多个参数分页了 |
|