4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CakePHPのページ送りのURLを修正する方法

Last updated at Posted at 2015-09-21

CakePHPのページ送りのURLを修正する方法

CakePHPでページ送りを実装するのに、Paginate ComponentとPaginate Helperを使いますが、ページ送りのURLがこのように「/sort:User.id/direction:ASC/」が付いてきてしまうので、それを削除する方法を紹介します。
http://example.com/page:2/sort:User.id/direction:ASC/

  • controllerで$this->paginate('User');したあとにunset($this->request->params['paging']['User']['options']['order']);をする

  • viewで$this->Paginate->numbers();の前に unset($this->request->params['paging']['User']['options']['order']);をする

どちらの方がいいかわかりませんが、これでページ送りのURLがhttp://example.com/page:2/になります。

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?