fixed pager
This commit is contained in:
parent
39dc81ad14
commit
3a55dcea49
@ -160,6 +160,8 @@ function materio_search_api_results_search(){
|
|||||||
: variable_get('defaultviewmode', 'full');
|
: variable_get('defaultviewmode', 'full');
|
||||||
|
|
||||||
$limit = variable_get($viewmode.'_limite', '10');
|
$limit = variable_get($viewmode.'_limite', '10');
|
||||||
|
// dsm($limit, "limit");
|
||||||
|
|
||||||
$offset = pager_find_page() * $limit; //$page*$limit;//
|
$offset = pager_find_page() * $limit; //$page*$limit;//
|
||||||
// dsm($offset, "offset");
|
// dsm($offset, "offset");
|
||||||
|
|
||||||
@ -314,16 +316,13 @@ function msa_solrquery_materiauxbreves($keys, $language, $user, $offset, $limit)
|
|||||||
# create items array with the good range
|
# create items array with the good range
|
||||||
$return['items'] = array();
|
$return['items'] = array();
|
||||||
|
|
||||||
$i = 0;
|
$o = -1;
|
||||||
foreach ($return['results'] as $nid => $value) {
|
foreach ($return['results'] as $nid => $value) {
|
||||||
if( $i < $offset )
|
$o++;
|
||||||
continue;
|
if( $o < $offset ) continue;
|
||||||
|
if ($o >= $offset+$limit) break;
|
||||||
|
|
||||||
$return['items'][$nid] = node_load($nid);
|
$return['items'][$nid] = node_load($nid);
|
||||||
|
|
||||||
$i++;
|
|
||||||
if ($i > $offset+$limit)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: cache the results with cache graceful : http://drupal.org/project/cache_graceful
|
# TODO: cache the results with cache graceful : http://drupal.org/project/cache_graceful
|
||||||
|
Loading…
x
Reference in New Issue
Block a user