coder1.com

  • home
  • drupal articles
  • contact
Home

Drupal do_search limit is hard coded to 10 - Here's a work-around

Mike Milano — January 23, 2009 - 2:57pm

Recently I had to implement a custom search function using Drupal's do_search() function. I needed to display many more results than 10, which is hard coded in the function.

The simple solution was this:

1. Go to http://api.drupal.org/api/function/do_search/6 (make sure you get the function for the correct version of Drupal you are using)

2. Copy the function and rename it to something like do_search_custom.

3. Add a parameter called $limit and make it default to 10. ( $limit=10 )

4. Replace pager_query argument at the bottom of the function with $limit.

  • Drupal do_search

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <img> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h3> <h4> <h5> <h6> <h7>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].

More information about formatting options

Poll

Have you checked out Drupal 7 yet? (still alpha):

User login

  • Request new password

Navigation

  • Recent posts
  • home
  • drupal articles
  • contact