1

To control the number of search results showing in a solr site search page there is a text field in admin/config/search/apachesolr/search-pages/core_search/edit

In advanced option tab, there is an option called Results per page to specify its count. but I need to alter the pagination displayed in search page. It displays 1 to 9 pagers by default I want them to be 5. what should I alter??

  • 1
    You could try overriding theme_pager() if you don't mind all pagers on your site changing to 5. – rooby Oct 25 '14 at 11:43
1

This could be done by using theme_pager in TEMPLATE.PHP and by applying some if condition to be specific on just the search page

if(arg(0) == "search" && arg(1) == "site") {

$variables['quantity'] = 5; 

}

These two lines did the magic !!!

  • Generally a better solution in this case would be to move that same code into THEMENAME_preprocess_pager($variables) in your template.php since you are only modifying one of the variables. – rooby Oct 25 '14 at 13:19
  • yep..thats what I did :) – Pravin Ajaaz Oct 25 '14 at 13:19
  • Your answer mentions theme_pager though not HOOK_preprocess_pager – rooby Oct 25 '14 at 13:33
  • Do you want me to use preprocess_pager instead of theme_pager.. May I know why you say so? – Pravin Ajaaz Oct 25 '14 at 13:35
  • You can do it either way however the preprocessor way uses less code and what you are doing is not actually changing the output code of the theme function but changing the variable used in the theme function. It keeps things consistent with the rest of Drupal themeing. There is a line on drupal.org/node/173880 that says "To customize the variables inside templates, see the sub-page on Preprocess functions.", which is drupal.org/node/223430 – rooby Oct 25 '14 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.