drupal 7 视图块和上下文过滤器不起作用
我正在尝试为块类型视图设置上下文过滤器,但是当我预览它时,它不会返回任何内容...更具体地说,当我尝试与页面相同的视图时,上下文过滤器工作正常并过滤内容,但是当我尝试将视图作为块,尽管“提供默认值”设置为“来自 url 的原始值”,但没有返回任何内容。知道可能是什么问题吗?顺便说一下,我在这里尝试了该解决方案,但它仍然不起作用 https ://drupal.stackexchange.com/questions/13868/drupal-7-views-contextual-filters-with-page-blocks
I'm trying to set a contextual filter for a block type views but when I preview it, it returns nothing... More specifically when I try the same view as a page the Contextual filter is working fine and filtering the content but when I try the view as a block nothing is returned although the "Provide default value" is set as "raw value from url". Any idea what might be the problem? By the way I tried the solution here but it's still not working https://drupal.stackexchange.com/questions/13868/drupal-7-views-contextual-filters-with-page-blocks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当使用视图作为块时,您需要启用 ajax 以使过滤器在其公开时特别工作。
进入高级->其他->并启用ajax并查看它是否有效。
干杯,
维沙尔
When using views as blocks you need to enable ajax for the filters to work specially if its exposes.
go to advanced -> other -> and enable ajax and see it it works.
cheers,
Vishal
我遇到了类似的情况:我使用内容标题作为页面的上下文过滤器,但是当我尝试对块使用相同的过滤器时,该块没有显示。当我将块的过滤器(仅块)设置为 content nid 并将默认值设置为“来自 url 的内容 id”时,它就像一个魅力即使内容 ID 不在路径别名中。诡异的。
i ran into a similar situation: i was using content title as the contextual filter for a page, but when i tried to use the same filter for a block, the block doesn't show up. when i set the filter for the block (just the block) to content nid and set the default value to 'content id from url' it worked like a charm EVEN THOUGH THE CONTENT ID IS NOT IN THE PATH ALIAS. weird.
这可能会帮助某人...
我正确设置了默认视图(在我的例子中:原始url - > /第2部分/,勾选路径别名)并且正确设置了验证标准(分类术语 - >勾选正确的内容类型 - > 术语名称转换为 id),但我从views_embed_view函数调用中传递了第三个参数:
我相信从第三个开始的参数将成为要检查的上下文过滤器值,我们希望用原始URL覆盖它。
This might help someone...
I had the default view set correctly (in my case: raw url -> /part 2/, tick path alias) and the validation criteria set correctly (taxonomy term -> tick correct content type -> term name converted to id) but I was passing a third argument from my views_embed_view function call:
I believe the arguments from the third onwards become the contextual filters values that are checked against, which we're looking to override with the raw URL.
解决办法是重新安装drupal,不知道为什么,清除缓存也没有帮助。
The solution was to re-install drupal, no idea why, clearing the cache wasn't helping.