【问题标题】:How to set url parameters into paginator numbers如何将 url 参数设置为分页器编号
【发布时间】:2016-04-04 21:51:43
【问题描述】:

如何将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>

【问题讨论】:

    标签: cakephp pagination cakephp-3.2


    【解决方案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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-10
      • 2018-12-09
      相关资源
      最近更新 更多