无法让搜索框显示在自定义主题中
我正在尝试为 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
中的标头。我是否错过了什么,或者我做错了什么?因为它仍然不起作用,并且开始让我生气......
谢谢。
来自法国的问候;)
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 ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
来自:http://drupal.org/handbook/modules/search
From: http://drupal.org/handbook/modules/search
Drupal 7 - 如果“搜索”块或任何其他块在“仪表板”中“启用”,则它不再在“结构”> 上可用。 “阻止”阻止列表页面。
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.
转到管理>>主题并配置您的自定义主题,然后选中搜索框。
Go to administer>>themes and configure your custom theme then check Search box.
如果您使用的是 drupal 7 请使用以下命令
if you are using drupal 7 please use the following
我也有同样的问题。就我而言,我发现在我的自定义主题 .info 文件中,我使用了一些功能,如下所示:
一旦添加一个功能,它就会覆盖所有内置功能的显示,例如搜索、等等,因此它们不会显示在主题的配置页面上。我遇到的情况是,在开始自定义主题之前,搜索框已被禁用,但因为我在配置页面上看不到它,所以无法重新启用它。
我终于发现我可以单击“重置为默认值”按钮,然后我的主题从此继承了全局默认值的搜索设置。
I had this same problem. In my case I found that in my custom theme .info file I was using some features like so:
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.
Drupal 7:
模块>搜索>权限>使用搜索>选择:匿名用户和经过身份验证的用户。
Drupal 7:
Modules > Search > Permissions > Use search > select for: ANONYMOUS USER and AUTHENTICATED USER.