如何将url参数设置为paginator数字

时间:2016-04-04 13:51:44

标签: cakephp pagination cakephp-3.2

如何将url参数设置为分页符号?

我的网址是company/overview/3?page=1&sort=Tenancies.stage&direction=asc

默认情况下,只有第一个分页符号具有参数。如何将参数应用于数字2,3,4 ......?

以下是我的观点:

    <div class="row paginator">
        <div class="col-lg-12">
            <div class="pull-left"><?= $this->Paginator->counter() ?></div>
            <ul class="pagination pull-right">
                <?= $this->Paginator->prev('< ' . __('previous')) ?>
                <?= $this->Paginator->numbers() ?>
                <?= $this->Paginator->next(__('next') . ' >') ?>
            </ul>
        </div>
    </div>

1 个答案:

答案 0 :(得分:1)

只需添加此行

即可
<?php $this->Paginator->options(['url' => $this->request->query]) ?>

例如:

<div class="row paginator">
        <div class="col-lg-12">
            <div class="pull-left"><?= $this->Paginator->counter() ?></div>
            <ul class="pagination pull-right">
                <?php $this->Paginator->options(['url' => $this->request->query]) ?>
                <?= $this->Paginator->prev('< ' . __('previous')) ?>
                <?= $this->Paginator->numbers() ?>
                <?= $this->Paginator->next(__('next') . ' >') ?>
            </ul>
        </div>
    </div>