drupalcontent-management-systemthemesdrupal-themingdrupal-themes

Can't get the search box to show up in custom theme


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 ;)


Solution

  • 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.