我可以使用一个公开的过滤器来过滤不同页面上的多个块视图吗?
我在一个页面上有四个块视图(称为“信息”页面),这些视图按邻近度进行过滤,为我提供与一个特定过滤位置相关的四条信息。
我希望能够创建一个带有公开的邻近过滤器的介绍页面,该过滤器在执行时会将我带到(信息)页面,并同时使用在介绍页面上输入的邻近过滤器来过滤四个视图。
我怎样才能做到这一点? 我是 php 新手,但正在学习......愿意为之工作!
谢谢
I have four block views on a page (call it "info" page) that are filtered by proximity to give me four pieces of information relating to one particular filtered location.
I would like to be able to create an intro page with an exposed proximity filter that when executed would take me to the (info) page and simultaneously filter the four views with the proximity entered on the intro page.
How can I do this? I am new to php but learning .... willing to work at it!
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在 Drupal 6 中使用视图,答案是肯定的——但有一些重要的注意事项。
与 Drupal 中的正常形式不同,视图公开的过滤器值以 $_GET 参数形式出现,而不是 $_POST。 这意味着您只需将 ?filter=value&filter2=value2 等附加到当前 URL 即可填充公开的过滤器。
更重要的是,如果同一页面上的多个视图在 URL 中查找相同的过滤器键,它们都将使用传入的过滤器值。 您需要配置每个视图的公开过滤器列表,以确保它们都使用相同的过滤器列表,并对传入值使用相同的“键”列表。 如果您希望过滤器表单只出现一次,您可能还需要进行一些巧妙的处理——默认情况下,视图会希望它出现在每个视图上,但每个视图上都有一个选项可以将其公开的过滤器移动到一个块中; 这样做并且不启用公开的过滤器块会有效地隐藏视图的公开过滤器小部件,同时如果通过 URL 进入则保持过滤活动。
总结一下:确保所有四个视图都具有相同的公开过滤器列表,并且对过滤器使用相同的“键”。 隐藏除一个视图之外的所有视图上公开的过滤器小部件。 到那时,它应该起作用了。
If you're using Views in Drupal 6, the answer is yes -- with some important caveats.
Unlike normal forms in Drupal, Views' exposed filter values come in as $_GET params raher than $_POST. That means that you can populate an exposed filter just by appending ?filter=value&filter2=value2 etc... to the current URL.
The kicker is that if multiple views on the same page are looking for the same filter keys in the URL, they will both use the incoming filter value. You'll need to configure each view's list of exposed filters to make sure that they all user the same list of filters, with the same list of 'keys' for the incoming values. If you want the filter form to only appear once, you may have to do some crafty juggling as well--Views will want it to appear on each view by default, but there's an option on each view to move its exposed filters to a block; doing that and NOT enabling the exposed filter block effectively hides the view's exposed filter widgets, while keeping the filtering active if it comes in via the URL.
To summarize: make sure all four views have the same list of exposed filters, and are using the same 'keys' for the filters. Hide the exposed filter widgets on all but one of the views. At that point, it should work.