链接到实际搜索页面的搜索表单
我使用公开的过滤器和视图模块创建了一个搜索页面。用户可以选择不同的值以获得具有特定结果(返回节点字段)的表。此页面位于 mysite.com/search 下。问题是我想在我的主页上放置一个简化版本的搜索表单(假设只是关键字搜索框+一两个复选框)。这可以是块或视图。当用户按下搜索按钮时,我想将他重定向到搜索页面并显示结果。在这里,用户应该能够以普通方式细化他的搜索。我想这可以通过 HTTP GET 参数并指向实际的搜索站点来实现。然而,我想知道是否可以在不对主页上的表单进行硬编码的情况下(即通过使用视图、块等)来做到这一点。我希望这是有道理的。任何帮助将不胜感激。
I have created a search page uising exposed filters and views module. The user can choose from different values in order to get a table with specific results (returning node fields). This page is located under mysite.com/search. The problem is that I would like to put a simplified version of the search form on my homepage (lets say just the keyword search box + one or two checkboxes). This can be a block or a view. When the user presses the search button I would like to redirect him to the search page and show the results. Here the user shall be able to refine his search in an ordinary way. I guess this can be achieved by HTTP GET parameters and pointing to the actual search site. I was wondering however if I could do it without hardcoding the forms on my homepage, i.e. by using views, blocks, etc. I hope this makes sense. Any help will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑
最终结果是您希望使用一个表单将您带到搜索结果页面,并在搜索结果页面本身上使用另一个高级表单。该解决方案通过为每个表单创建两个具有不同过滤器的相同视图来实现此目的。
当有人使用简化表单时,他们会被带到 example.com/search,而当他们在该页面上并使用高级表单时,他们会被带到 example.com/search/advanced。由于视图与相似路径相同,因此最终用户不会知道其中的差异。
实现此目的的方法如下:
现在,您将拥有两个视图页面:搜索 和搜索/高级,以及两个块:一个简化的搜索表单和一个高级搜索表单。
转到块管理,然后启用简化搜索块。使用路径特定的可见性设置来设置您希望简化搜索框出现的位置。
现在,启用高级搜索块。使用路径特定的可见性设置将可见性设置为:
假设您想使用一组不同的过滤器创建另一个简化的搜索块(我们称之为替代)。您也可以这样做:按照步骤 2-4 中的操作在视图中创建另一个页面显示,但不要使用路径 search,而是为其提供不同的路径:search/alternate嗯>。您可以根据需要添加任意数量的具有不同过滤器的简化表单,并且当您使用它们时,它们都将具有高级搜索表单和相同的结果。
Edit
The end result is that you want to have one form bring you to the search results page, and another advanced form on the search results page itself. This solution accomplishes this by creating two identical views with different filters for each form.
When someone uses the simplified form, they're taken to example.com/search, and when they're on that page and use the advanced form, they're taken to example.com/search/advanced. Because the views are identical with similar paths, the end user won't know the difference.
Here's how to accomplish this:
Now, you'll have two view pages, search and search/advanced, and two blocks, a simplified search form and an advanced search form.
Go to the block administration, and enable the simplified search block. Use the path specific visibility settings to set where you want the simplified search box to appear.
Now, enable the advanced search block. Use the path specific visibility settings to set the visibility to:
Let's say you wanted to create another simplified search block with a different set of filters (let's call this alternate). You can do that too: create another page display in your view as you did in steps 2-4 but instead of using the path search, give it a different path: search/alternate. You can add as many simplified forms with different filters as you want, and they'll all have the advanced search form and the same results when you use them.