I am currently using CakePHP's pagination function but I need to call a php function before showing the result.
this->paginate = array(
'conditions' => $conditions,
'limit' => 10,
'fields' => $fields,
'joins' => $joins,
'group' => $group,
'passit' => $this->passedArgs
);
$result = $this->paginate('ModelName');
$compare = $this->callGetListToExcludeFunction($sampleParam);
$finalResult = $this->callCompareResultToExcludeListFunction($result,$compare);
$this->set(compact('finalResult '));
The above sample outputs the correct data, but the page count / preview and total is erroneous.
For example, pagination limit is 10 per page, the result view will only show 6 because of the additional php function. Or, the total page would always show higher count.
Is there a way I could call the predefined PHP function before the pagination will add the limit function? This will get the accurate count and total for each search. I cannot add the exclude list in the Model because it is being returned by an API call.
Thank you in advance!
Aucun commentaire:
Enregistrer un commentaire