By JonMB on
I want to add a search box in my Primary links header. Not just a link to the search page, but an actual search box where people type in what they're looking for and click "Submit." I'm sure this is possible but I don't know how.
Comments
There are several themes
There are several themes that will allow you to place a search box in the same vicinity as the primary links (I am thinking of the bluemarine theme, for one). Go to theme, global settings, and look for the search box form.
----------------------------------------------------------------------
http://www.bwv810.com/
I am a writer and researcher. In my spare time I build websites with Drupal.
Je peux communiquer en français. / Я могу общаться на русском языке.
Solution to your question
I ran into same problem before, all you need to do is to copy code below, and past inside your primary links section, you might have to do some CSS change to make it look right.
print $search_boxbelow is how it looks like inside the primary
if (isset($primary_links)) {print theme('links', $primary_links)}print $search_boxyou might see submit button, you might not, if you don't, you need to go to template.tpl.php add following code to it
/**
* Altering search form
*/
function phptemplate_search_theme_form($form) {
$form['#prefix']='
$form['#suffix']='
';
//unset ($form['submit']);
$form['submit'];
$form['search_theme_form']['#title'] = t('Search');
return drupal_render($form);
}
?>
hopefully this helps your case.
Thank you both for the quick
Thank you both for the quick replies. I will try these solutions.
Update: I still seem to be having a problem. All I see on the Primary links menu is a link saying "Edit primary links."
Here is my code:
you should go to your
you should go to your page.tpl.php file, and find where your primary_links section is, then paste the print search box code there.
I got it working now, and I
I got it working now, and I can position it with CSS. Thanks everyone.
search box in primary links
what do you do to add search box in primary links ???
Hey
I want to add the search box to the primary links as well but the designer wants it between primary links. So you would have
and I can't convince them otherwise. How would you accomplish this?
other solution
the print $search_box didnt work for me in a block with a menu, so i did
//trying to answer one question for each one that i make.
//this way, drupal will be more friendly and strong
Done- but search invisible for anonymous users?
Any idea how to remedy this?
where do you print it?
i use it in a block that anonymous users can see and i have not that problem.
//trying to answer one question for each one that i make.
//this way, drupal will be more friendly and strong
In the top bar
I have it printed in the top bar, and used css to move it down beside primary links. It is perfect, except for the fact anon users cant see it. No idea what to do!