Home > Backend Development > PHP Tutorial > laravel怎么改造分页类,给他加上首页和尾页

laravel怎么改造分页类,给他加上首页和尾页

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:39:13
Original
1057 people have browsed it

求助laravel的分页类该怎么改造下。可以生成有首页,尾页,有总计多少条记录,当前第几页,分页,

回复内容:

求助laravel的分页类该怎么改造下。可以生成有首页,尾页,有总计多少条记录,当前第几页,分页,

可以考虑扩展Illuminate\Pagination\Presenter和添加分页模版。
目前我就是这样做的:

<code>class ExtPresenter extends Illuminate\Pagination\Presenter{

    public function getActivePageWrapper($text)
    {
        return '<span class="current">'.$text.'</span>';
    }

    public function getDisabledTextWrapper($text)
    {
        return '<span class="ellipsis">'.$text.'</span>';
    }

    public function getPageLinkWrapper($url, $page,$rel = null)
    {
        return '<a href="'.%24url.'">'.$page.'</a>';
    }

}
</code>
Copy after login

分页模版

<code><?php $presenter = new ExtPresenter($paginator);
?>

<?php if ($paginator->getLastPage() > 1): ?>
    <div class="cms_page">
        <?php echo $presenter->render(); ?>
    </div>
<?php endif; ?>
</code>
Copy after login

抱歉,上面代码好像没回答你问题重点上,如何加上首页与尾页,可以考虑参阅下面文章:
http://php2012web.blog.51cto.com/5585213/1539601

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template