views:

173

answers:

3

Hi guys !

I'm trying to make a custom theme for a drupal blog, and I want the search box to appear in the header. To do that, I've put the following code in the page.tpl.php template file :*

<?php if ($search_box): ?>
    <div id="search-box"><?php print $search_box; ?></div>
<?php else: ?>
    <h2>Pas de search box</h2>
<?php endif; ?>

But the damn thing won't show up. I did some research on google, and checked the Search module on admin/build/modules and admin/build/themes/settings/mytheme, and added the search form to the header in admin/build/block/list/mytheme. Did I miss something, or did I do something wrong ? Because it's still not working, and beginning to piss me off...

Thanks.
Regards from France ;)

A: 

From: http://drupal.org/handbook/modules/search

If both the search module and the menu module are enabled, from the menus page (administer >> menus) you can enable on the Navigation Menu the item Search. The option to show this menu item may be disabled by default, but you can enable it. (And you can rename "Search" to whatever you wish.)

You can also place a link to Search among your site's primary and secondary links, or on any other menu as well. (Click "add menu item," and when you fill in the "path" field on the dialogue page just enter "search.")

On your blocks page (administer >> site building >> blocks in Drupal 6, and administer >> structure >> blocks in Drupal 7) there's also a Search form you can enable, and you can choose where you want it to display.

On your permissions page (administer >> user management >> permissions in Drupal 6, or People >> Permissions in Drupal 7) you can decide who can do searches and who can administer the search settings. By default, anonymous users cannot perform searches.

A technical note: To use the search module the database user needs the create temporary table permission. If you seem not to have it, ask your systems administrator to make sure it's granted to you.

bkildow
A: 

I had this same problem. In my case I found that in my custom theme .info file I was using some features like so:

features[] = MyFeature

As soon as you add one feature, it overrides the display of all the built in features such as search, etc, and so they don't show up on the configuration page of your theme. What happened with me was that the search box had been disabled before I started my custom theme, but because I could not see it on my config page, I could not re-enable it.

I finally discovered that I could click the "reset to default" button and then my theme inherited the search settings from the global defaults from then on.

Dana
I already had all the features I needed, and it didn't show up... @bkildow's solution was the one
Squ36
A: 

Go to administer>>themes and configure your custom theme then check Search box.

shilpa