This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Akhil
Akhil

Hi my Pagination was working perfectly in BETA. Now, in RC i am getting an error "Paginator" class not found with the old code.

             // Old code for Beta
              App::make('paginator')->setCurrentPage($page);
               $model->paginate($perPage);

             // New code for RC
            $model->paginate($perPage, $page);

I tried to implement new code but unable to understand how to use in my component. My code is like this :

     $page = (intval($this->property('pageParam')) < 1 ? 1 : intval($this->property('pageParam')));
     $num1 = $this->postsPerPage * ($page - 1); // skip first 100 rows
$num2 = $this->postsPerPage; // take only 2 rows 

    $posts = DB::select(DB::raw("SELECT *column FROM Table 1 Union Table 2 union Table3 ");
    App::make('paginator')->setCurrentPage($page);
return  Paginator::make($posts, $this->listAllPosts(), $this->postsPerPage);

Let me know how i will use with new code in RC like $model->paginate($perPage, $page); since, i am using $posts not $model.

Last updated

Flynsarmy
Flynsarmy

Pagination is changed in L4. Have a look at the info on the migration page.

Akhil
Akhil

Ya i went through that doc. IT SAYS

          // Old code for Beta
           App::make('paginator')->setCurrentPage($page);
           $model->paginate($perPage);

          // New code for RC
          $model->paginate($perPage, $page);
Akhil
Akhil

Now the question is how i will use // New code for RC which says simply to do like $model->paginate($perPage, $page);

Let me know how i will use with new code in RC like $model->paginate($perPage, $page); since, i am using $posts not $model.

     $page = (intval($this->property('pageParam')) < 1 ? 1 : intval($this->property('pageParam')));
     $num1 = $this->postsPerPage * ($page - 1); // skip first 100 rows
$num2 = $this->postsPerPage; // take only 2 rows 

    $posts = DB::select(DB::raw("SELECT *column FROM Table 1 Union Table 2 union Table3 ");
    App::make('paginator')->setCurrentPage($page);
return  Paginator::make($posts, $this->listAllPosts(), $this->postsPerPage);

Last updated

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.