Drupal 5 搜索不适用于 404 页面
我有一个 在我的 page.tpl.php 页面中。在存在的页面上,搜索可以工作,但在 404 页面上,则不能。
我在 drupal.org 上看到了 D6.15 的一些错误/补丁线程,但它们似乎都没有按照线程工作,而且它们与 D5.x 并不真正相关。
我有一个理论,因为 创建一个对其自身有操作的表单(一个不存在的页面),它会得到 404。
有人遇到过这个吗?如果是这样,你是如何解决的?
我的一个理论是以某种方式利用表单并始终使操作=“/”(首页)始终存在。
如果这是个好主意,那么如何利用 FormAPI 并覆盖操作呢?它是一个预处理函数吗?
I have a <?php print $search_box; ?>
in my page.tpl.php page. On pages that exist, the search works, but on 404 pages, it does not.
I saw some bugs/patches threads over at drupal.org for D6.15, but none of them seem to work according to the thread and they weren't really relevant to D5.x
I have a theory that the because the <?php print $search_box; ?>
creates a form with an action to itself(a non-existant page), it'll get the 404.
Has anyone run up against this? If so, how did you fix it?
One theory I has was to somehow tap into the form and always make the action="/" (front page) which would always exist.
If this is a good idea, how does one go about tapping into the FormAPI and overwriting the action? Is it a preprocess function?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
drupal_get_headers()
检查正在显示的页面是否是 404。$form['#action']
属性,以固定首页或您希望将用户重定向到的任何其他页面。我还没有测试过这个,但它应该有效。
drupal_get_headers()
to check if the page being displayed is a 404.$form['#action']
attribute in your search form to fx the front page or any other page that you would like to redirect the user to.I haven't tested this, but it should work.