I want to show some extra information on the search result page in Drupal. I want to implement it in a module (and not in the theme).

I am using this code in my custom module:

function custommodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op){
     case 'search result':
      return 'TEST';

When I debug the statement, the line return 'Test' is executed. I would expect this extra information to show up at: search-result.tpl.php in the variable $info.

However this extra information is not included. Has anyone got a clue how to pass this extra information so it shows up at the result page?

1 Answer 1


You could try this


function your_custom_module_name_preprocess_search_results(&$variables){
    $var['info'] = 'the_value_you_want_to_include';

Now you can use the variable $info in search-result.tpl.php.

  • 1
    That was not exactly what I was looking for I guess. I have to implement this in the template.php (which is part of a theme). I am looking for a solution to alter the display of the search results by using a module. I have a multi site solution. Each site uses the same theme, but the display of the search results can vary. Each site can have is own module to configure stuff. So that's why I am looking for a module solution instead of a theme solution.
    – Paul
    Sep 17, 2012 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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