Wednesday, February 18, 2015

cant remove page from url pagination to prevent error

Hi, In cakephp

     

I keep getting a page out of range error.

The problem only happens when I am page:2 or above and I perform a search. The search works fine unless this is only 1 page found and then I get the error if the URL has page 2 or above.

I tried resetting the page no, to 1 and I tried a try/catch block without any success, from previous posts.

How can I perform a search and reset the page:x back to page1 so I dont get this error? I couldnt find this answer in the docs or google.

http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper

Error: The requested address '../admin_list2/page:2' was not found on this server.

in controller         $this->Paginator->settings = array(                        'conditions'=> array ($tutor=>$tutorId,$conditionStartDate=>$valStartdate,                             $conditionEndDate=>$valEnddate, $conditionInvoice=>$invoice),                         'order' => array('TimeSheet.period_start_date'=>'desc'),                            'limit' => $noRecords,                  'page' => 1,                         'recursive'=>-1);                      $timesheet= $this->Paginator->paginate('TimeSheet');        try {          $this->Paginator->paginate();      } catch (NotFoundException $e) {          //Do something here like redirecting to first or last page.            debug('error'); // never works      }    http://....list2/page:2


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: