views:

323

answers:

2

I'm trying to customise the mark-up of the default search results page in Drupal 6. Specifically I'd like to remove the search box and the title from the page - I know I can hide it with CSS, but I'd rather it wasn't rendered in the first place.

Ideally, in the same why that you theme a particular content type node by copying the node.tpl.php and renaming it to something like node-blog.tpl.php and then amending the mark-up accordingly - is there an equivalent way to do this for the search results page?

A: 

How you get the search box determines how you can hide it. Generally search boxes come from two places.

  • A block, created by views or some search module.
  • Defined / created in the theme itself.

How do you remove those?

  • A block is easy to remove, as you can in it's settings select which pages to display it on.
  • If the search box is created in the theme, it's a bit more tricky to remove. You have to find out what it is called, when it is defined which should happen in the template.php. Then you need to make a preprocess_function in your theme, where you with some logic, can remove the variable or set it to an empty string.
    Alternatively, you could create a custom page.tpl.php for your search result page, where you exclude the search box, when it is printed in the page template.

So while it can be done, it requires some work in the second case if you want to purify your markup.

googletorp
That is very helpful, thank you. It looks like I will have to engage the preprocess_function to set it to an empty string.
David Pratt
A: 

have you found the solution yet? I'm trying to find out how to do it using the preprocess_function. But still not luck..

B. Rad

related questions