I want a public search box at the top right hand corner of my site, for which the template-files have been modified. Site-wide keyword searching is enabled through the administer | modules section. Currently it is enabled for registered users, but how is it publicly made visible?

Comments

PAAHCweb’s picture

If you want your search box in the header for more than one theme, head to:
http://example.com/admin/themes/settings
If you're using just one theme:
http://example.com/admin/themes/settings/(folder name of your theme)
- Make sure the search box option is checked.
- Make sure you're using a theme with a search box in the header.
- Most bundled themes have one - check the page.tpl.php to be sure.

If you want the search box on the top right of the sidebar, go to:
http://example.com/admin/block
- Check the boxes to enable the search block, and place it on the right.
- Make sure "weight" is a lower number than anything else on that sidebar.

(Of course, if you have drupal in a sudirectory, those URL's will be:
http://example.com/drupal/admin/etc./etc.)

D.

figaro’s picture

I had already followed the instructions in your response. But how do I make the search box publicly visible?

PAAHCweb’s picture

Where did you enable it? In admin/themes/settings, or in admin/block?

figaro’s picture

Thanks for getting back

It is enabled in admin/themes/settings
It is enabled in menus
It is disabled in blocks.

Hope this helps

PAAHCweb’s picture

>Thanks for getting back

No problem, I've been haunting this place for two months, and I know how frustrating it is to feel invisible.

>It is enabled in admin/themes/settings
>It is enabled in menus
>It is disabled in blocks.

So far so good. Using FTP or CPanel, look in the folder for your default theme; find a file called page.tpl.php.

Do you see some variation of this code somewhere near the top? It would probably be just after the logo, site name, and slogan are mentioned.

<?php if ($search_box) { ?>
<form action="<?php print $search_url ?>"method="post">
<div id="search">
<input class="form-text" type="text" size="15" value="" name="edit[keys]"alt="<?php print $search_description ?>" />
<input class="form-submit" type="submit" value="<?php print$search_button_text ?>" />
</div>
</form>
<?php } ?>

What is your default theme, btw?

Cheers,
D.

sslxt’s picture

I've put search box into block which visible on every page and this approach works fine for me.

-------------------------
My blog powered by Drupal
Your guide to watches

figaro’s picture

Thanks again for your response. There is the line <?php print $search_box ?> in page.tpl.php, but there is no other occurence of $search_box. When made visible the HTML reads:

<form action="/" method="post" id="search_theme_form">
<div>
<div id="search" class="container-inline">
<div class="form-item">
 <input maxlength="128" name="edit[search_theme_form_keys]" id="edit-search_theme_form_keys" size="15" value="" title="Enter the terms you wish to search for." class="form-text" type="text">
</div>
<input name="op" value="Search" class="form-submit" type="submit">
<input name="edit[form_id]" id="edit-search-theme-form" value="search_theme_form" type="hidden">
</div>
</div>
</form>

The search function is operational.
Theme is bluemarine on top of engine phptemplate. Hope this helps.

PAAHCweb’s picture

Did you actually open page.tpl.php from your theme folder? You can't see it by viewing the source code of the page it generates. In Windows you can right click on the file name --> send to --> Notepad.

In the bluemarine page.tpl.php, right under the body tag, you should see this table (below). If it's not there, you might try pasting it in:

<table border="0" cellpadding="0" cellspacing="0" id="header">
  <tr>
    <td id="logo">
      <a href="./" title="Home"><img src="<?php print $logo ?>" alt="Home" border="0" /></a>
      <h1 class='site-name'><a href="./" title="Home"><?php print $site_name ?></a></h1>
      <div class='site-slogan'><?php print $site_slogan ?></div>
    </td>
    <td id="menu">
      <div id="secondary"><?php print is_array($secondary_links) ? theme('links', $secondary_links) : "" ?></div>
      <div id="primary"><?php print is_array($primary_links) ? theme('links', $primary_links) : "" ?></div>
      <?php if ($search_box) { ?><form action="<?php print $search_url ?>" method="post">
        <div id="search">
          <input class="form-text" type="text" size="15" value="" name="edit[keys]" alt="<?php print $search_description ?>" />
          <input class="form-submit" type="submit" value="<?php print $search_button_text ?>" />
        </div>
      </form><?php } ?>
    </td>
  </tr>
</table>

To find out what else might be missing, you should probably compare your files with those at http://drupal.org/project/bluemarine.

Good luck,
D. Lynn

sepeck’s picture

Make sure that Anonymous users have permission to see it.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

figaro’s picture

@Steven's response: how is the search for anonymous users enabled?

I currently have on Drupal 4.7.2 the following for the search function:
- modules: enabled
- blocks: disabled, because the bar should be in the header as opposed to the sidebars
- menus: disabled, because it should not be a menu item
- admin >> themes: enabled

Thanks in advance

figaro’s picture

Administer > access control > search module: check search content

JanusCoriolanus’s picture

In my admin/themes/settings I cannot enable the options User pictures in posts, User pictures in comments nor the Search box. They are gray. Why is that? Another option elsewhere blocking it?

Edit: Right! I had to enable the module for it. :)