Hi. I'm trying to theme the search and search results for my theme but somehow the HTML thats generated by Drupal is outputting a rogue

which throws out my spacing:
Enter your keywords:

See that first

. Don't know where it's coming from and I can't target it to change its style.

Any help very much appreciated.

- Luke

Comments

JonGirard-1’s picture

You might have to reword your question better, because we can't see the " first ." that you mentioned.

pan69’s picture

Sorry, forgot to put 'code' tags around the HTML :) The first div, can't find where that comes from.

<div>
<div class="form-item">
 <label>Enter your keywords: </label>

 <div class="container-inline"><div class="form-item" id="edit-keys-wrapper">
 <input type="text" maxlength="255" name="keys" id="edit-keys" size="40" value="tft" class="form-text" />
</div>
pan69’s picture

Theming anything related to search is a real pain in the ass. What is the proper way of getting rid of the advanced search box on the results page? When no results are found there is the stupid 'blue smurf' text, where does that come from? I don't want blue smurfs on my site...

Is there any documentation that describes all this? I can't find it...

Any help very much appreciated.

ainigma32’s picture

The advanced search box should only show up if you have the "use advanced search" permission. So by revoking that you can get rid of it easily.

To get rid of the blue smurf (we don't need no stinkin' bleu smurfs ;-) you could override the theme_box that is called in search.pages.inc:

        $results = theme('box', t('Your search yielded no results'), search_help('search#noresults', drupal_help_arg()));

The search_help contains the famous "smurf" text.

Alternatively you could just change the help text see here: http://drupal.org/node/21969

HTH

Arie

pan69’s picture

OK. Now where getting somewhere. However... Disabling the permissions gets rid of the expandable menu, it still shows the "Enter your keywords" bit with the input field. Isn't that part of advanced search? How do I get rid of that. I don't want an extra search box on my results page, I already have a search box sitting in a block.

>> you could override the theme_box that is called in search.pages.inc:

Sorry, but you need to spell it out for me. I'm kinda new to this...

Thanks in advance!

ainigma32’s picture

But also a lot more elegant. Add this to your template.php file and replace 'garland' with the name of your theme.

function garland_theme() {
  return array(
    'search_form' => array(
      'arguments' => array('form' => NULL),
    ),
  );
}

function garland_search_form($form) {
  if(arg(0) == 'search'){
    return '<em>'. t('Killed the search form') . '</em>';
  } else {  
    $simple = '';
    foreach (element_children($form) as $element) {
      if ($element == 'advanced') {
        $advanced = drupal_render($form[$element]);
      }
      else {
        $simple .= drupal_render($form[$element]);
      }
    }
    return $simple . $advanced;
  }
}

See here http://drupal.org/node/223463 for more info.

- Arie

pan69’s picture

Mate, thanks a bunch. You're a life saver!