Pagination of search results...
mediumgrade - December 27, 2007 - 01:17
I want to configure the search module to paginate the search results so that it only shows 10 results per page. How can this be done?
Thanks,
I want to configure the search module to paginate the search results so that it only shows 10 results per page. How can this be done?
Thanks,
=-=
There is no reason to post multiple threads asking the same question. If you don't recieve an answer in 12 - 24 hours, bump the original post.
I've removed the other threads.
From what I can see, the search.module does limit to 10 results per page.
what version of Drupal is in use ?
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
Version 5. Do I have to
Version 5. Do I have to change the module directly?
How does one "bump" the original post?
=-=
version 5 point what ?
again, you state you want the search to show only 10 results and then be paginated, From what I can see on drupal.org it looks to me to already show 10 results with pagination.
how many results is your site showing ?
I am not saying to hack the search.module, I am trying to clarify your question and insure we aren't chasing our tail here.
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
My Apologies. Drupal 5.5. If
My Apologies. Drupal 5.5.
If I wanted to change the number of results shown before pagination (say, 5 results, then paginate), where would I go?
=-=
function theme_search_page($results, $type) {
$output = '<dl class="search-results">';
foreach ($results as $entry) {
$output .= theme('search_item', $entry, $type);
}
$output .= '</dl>';
$output .= theme('pager', NULL, 10, 0);
return $output;
}
I believe the above function is what handles this in the search.module
That being said, I believe you can move add this to your template.php and change the function name to YOURTHEME_search_page as per http://drupal.org/node/55126
Then you can change the integer 10 to 5.
That being said, I've not tested this, so do so on a test site.
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
Actually, that wasn't
Actually, that wasn't it.
The line of code needing to be edited is in the search.module file on line 871 (in search module version 1.209.2.5)
$result = pager_query("SELECT * FROM temp_search_results", 10, 0, $count_query);I simply changed the 10 to the desired number. The theme_pager function simply outputs some HTML to make the paging links at the bottom of the search results.
Now, while this works, I don't like having to edit the search module to do it. Is there a way for me to override the query? Is this something I should suggest for a future version of this module?
=-=
you may be able to override with hook_form_alter, I've not tested.
as far as feature for a future version, if a patch was created that added this to the admin area under search settings and allowed variable to be set, I'd be all for it.
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )