通过服务端点将上下文过滤器参数传递给视图

发布于 2024-12-29 13:13:24 字数 298 浏览 4 评论 0原文

我创建了一个具有上下文过滤器的视图。然后我创建了一个服务(使用服务模块)来提供视图。例如,假设我的服务名称是搜索,我的视图名称是具有上下文过滤器城市的动物园。以下 url 将返回正确的内容: http://?q=search/views/zoos.json http://?q=zoos/Austin

但是如果我执行以下操作: http://?q=search/views/zoos.json/奥斯汀 我会收到 404 响应。

使用服务时如何将参数传递给视图?我使用 7.10 和 3.1 来处理服务和视图。

我非常感谢您的所有回复。

I created a view that has contextual filter. Then I created a service (using Services module) to serve up views. For example, let's say my service name is search, and my view name is zoos with a contextual filter city. The following url will return the correct contents:
http:/?q=search/views/zoos.json
http:/?q=zoos/Austin

But if I do the following:
http:/?q=search/views/zoos.json/Austin
I will get 404 response.

How do I pass arguements to a view when using service? I'm using 7.10 with 3.1 for Services and Views.

I'd appreciate all of your response.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我还不会笑 2025-01-05 13:13:24

我只能让上下文过滤器处理服务中的“视图”资源。我最初尝试创建一个“服务视图”并将其选择为资源,但也无法让端点注册我的参数。如果作为常规视图恢复并指定 view_id 来完成,它会像魅力一样工作。

这似乎是模块中的一个错误,但我无法花时间来追查它,因为替代方案对我有用。

I was only able to get contextual filters to work on the "views" resource in the service. I originally tried to create a "service view" and sleect it as the resource but wasnt able to get the endpoint to register my arguments either. If done as a a regular views resurce and specifying the view_id it worked like a charm.

THis seems to be a bug in the module but i wasnt able to devote time to chase it down since the alternative worked for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文