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
Saline is correct You can store post variables in session and then use again or use GET method. – Salines 1 hour ago
This tutorial explains how it is done.
http://www.pabloleanomartinet.com/cakephp-2-x-filter-basic-search-example/