5

Drupalブログのカスタムテーマを作成しようとしていますが、ヘッダーに検索ボックスを表示したいと思います。そのために、page.tpl.phpテンプレートファイルに次のコードを追加しました:*

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

しかし、いまいましいことは現れません。私はグーグルでいくつかの調査を行い、検索モジュールをadmin/build/modulesとでチェックしadmin/build/themes/settings/mytheme、検索フォームをのヘッダーに追加しましたadmin/build/block/list/mytheme。私は何かを逃しましたか、それとも何か間違ったことをしましたか?それはまだ機能しておらず、私を怒らせ始めているので...

ありがとう。
フランスからよろしく;)

4

7 に答える 7

15

差出人: 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.

于 2010-08-09T18:55:45.597 に答える
4

Drupal 7 - If the "Search" block, or any other block, is 'enabled' in the "Dashboard", it no longer is available on the 'Stucture' > 'Blocks' block list page.

于 2012-05-26T05:48:01.797 に答える
2

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

于 2010-09-09T17:21:20.230 に答える
2

if you are using drupal 7 please use the following

<?php if($page['search']): ?>
    <!--start search-->
    <div id="search">
      <?php print render($page['search']); ?>
    </div>
    <!--end search-->
  <?php endif; ?>
于 2011-03-21T10:55:32.330 に答える
1

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.

于 2010-08-11T17:10:11.317 に答える
1

Drupal 7:

Modules > Search > Permissions > Use search > select for: ANONYMOUS USER and AUTHENTICATED USER.

于 2012-04-01T15:52:31.577 に答える
0
//clear target element - optional
$('[data-id=1381]').html('');
//move search form
$('#search-block-form').appendTo('[data-id=1381]');
于 2015-02-21T22:03:08.093 に答える