Does anyone know how to move the search box from the top of one of the template themes to the sidebar? I tried just pasting the code in xtemplate.xtmpl from the top to just above the sidebar blocks but I get this error:

user notice: [XTemplate] parse: blockname [header.search_box] does not exist in /home/politic/public_html/themes/engines/xtemplate/xtemplate.inc on line 418

Seemed like it should have worked...dunno.

Comments

dublin drupaller’s picture

Quick answer.

(a) go to administer - blocks - add

(b) Replace the brackets and paste in the following code and give the block a logical title like "search box"

(Replace square brackets with angled brackets. I can't paste in the html code in a post)

[form action="?q=search" method="post"]
        [div id="search"]
          [input class="form-text" type="text" size="15" value="" name="keys" alt="Enter the terms you wish to search for." /]
          [input class="form-submit" type="submit" value="Search" /]
        [div]
      [/form]

(c) Make sure you have FULL HTML selected

(d) Position your block appropriately.

(e) save configuration

Hope that works for you..

Dub

DUBLIN DRUPALLER
___________________________________________________
A drupal user by chance and a dubliner by sheer luck.
Using Drupal to help build Artist & Band web communities.

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

calebgilbert’s picture

That works totally great! Thanks a million. :-)

Political Physics

Steven’s picture

As of 4.6, search.module has a built-in block. You can enable it from administer - blocks.

--
If you have a problem, please search before posting a question.

peterVG’s picture

Thanks Dub. That worked just great (moving search box to a block).

However, now I want to eliminate the Search Box from the header menu (so that there is only one Search box on my website).

If I disable the Search module itself, the Search box in the header menu dissapears but so does the Search functionality for the new Search box in the sidebar block.

Also, if I simply delete the Search Box form definition in the xtemplate.xtmpl file, I get the following message:"user notice: [XTemplate] parse: blockname [header.search_box] does not exist in /home/peterv/public_html/themes/engines/xtemplate/xtemplate.inc on line 418."

I have looked through the xtemplate.inc file but I am not sure which piece of code it is referring to in there (my Cpanel text editor doesn't have a line counter, besides I assume it is referring to the output of one of the functions in xtemplate.inc anyway).

I am a completely new to Drupal, any assistance on how to eliminate the Search box from the header menu (while maintaining Search functionality for the Search box in the sidebar block) would be appreciated.

Cheers,

Peter

peterVG’s picture

O.K. I'll answer my own question here in case anyone else is trying to do this.

To remove the Search box from the header menu (but still have the Search module enabled), simply delete all of the FORM tags between the 'BEGIN: search_box' and 'END: search_box' tags in the xtemplate.xtmpl file (but be sure to keep the BEGIN and END tags).

That way xtemplate.inc won't complain about the 'header.search_box' not existing. You can then go ahead and add the Search Box as a block somewhere else using the method Dub suggests above.

I realize this is a hack but I am new to Drupal and PHP and could not figure out what the input source was for the array in the xtemplate.inc file that ends up spitting out (and looking for) header.search_box.

The proper way to handle this would of course be to simply eliminate the search_box from xtemplate code that builds the header. If anyone can still clarify where and how to do this that would be appreciated.

SimonP’s picture

Or more simply, at administer->themes->settings there's a 'toggle display' section which includes a checkbox to turn the search box in the page header on or off.

peterVG’s picture

No way! What an idiot I am. Thanks for pointing that out SimonP!

vidyak’s picture

This really works!

childhood’s picture

hi

needed to move the searchbox as well, working perfectly. The only thing i cant figure out is removing the link that's on the top right. Can anyone help me out here? I only want the search function on the left side (with the custom block) but nowhere else, not even with links etc.

thx in advance

menesis’s picture

Have to define your own primary links. Go to administer > themes > configure. View source of your site and copy them into "Primary links" textarea. Edit as needed, i.e. remove "search" link.

drupallinux’s picture

i removed that bit from header, as it was showing even when i turned off primary links. weird.
in drupal 4.7 im using blue marine theme.

i went inside the theme folder, blue marine....... find a file called page.tpl something....... and if you know your html well, you will see where the search menu

cell is. infact i deleted the whole row...... and added my own
under the body

my page can be viewed at http://immy.myboard.info/sitelancers