Cake PHP 3.5 multiple pagination


#1

Hello,
I created a media library with some tabs (images,videos,audios,files) ; each tab contains a list with the related entitys and a paginator. So I have 4 paginated lists in my view.

My controller set up for paginate looks like:
public $paginate = [
‘Images’ => [‘limit’ => 10, ‘scope’ => ‘image’],
‘Videos’ => [‘limit’ => 8, ‘scope’ => ‘video’],

];

In my controller action i set the values like :
$images = $this->paginate($imageTable->find(‘all’,$image_options), [‘scope’ => ‘image’]);
$videos = $this->paginate($videosTable->find(‘all’, $video_options), [‘scope’ => ‘video’]);
$this->set(compact(‘images’, ‘videos’));

In my views i set the paginator :
$paginator->numbers([‘model’ => ‘Images’])

Now I have all lists with the paginator and it works for all pages with a link structure like :

  • …/media?image[page]=2
  • …/media?video[page]=20

but for all paginators the link for the first page is looking equal like:

  • …/media
    so i can’t differentiate which page 1 I have to load.
    I load the pages with ajax.

What I am doing wrong?
Or how I can change the generated link for the

  • ->first()
  • ->prev() (if prev is first page) and
  • ->numbers()
    to add at least the scope at the end of the url so I can get url’s for the first pages like:
    …/media?video or …/media?video[page]=1

Thanks