将 cck 字段作为视图中的参数传递
我有一个名为 event 的内容类型,它有一个名为 event id 的 cck 字段。这个想法是,一旦用户访问具有该 id 的 url,则仅显示与该事件 id 相关的信息。在我看来,我尝试创建一个块视图并将事件 ID 作为参数传递,一旦我这样做,以前在实时预览中显示的结果就会消失。不太确定我做错了什么,或者如果我应该是块视图。这应该是页面视图吗?请帮忙。
I have content type called event, which has a cck field called event id. The idea is that once a user goes that a url with that id, only information relating to that event id is displayed. In my view, i tried creating a block view and passed the event id as an argument, as soon as i do that, the results which formerly displayed in the live preview disappears..Not quite sure of what i am doing wrong, or if i should be block view. Should this be a page view? Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您应该创建页面视图而不是块视图。你必须传递一个论点。事件 ID 等于 NodeID 吗?如果是,那么您应该添加 Node:NID 类型的参数,然后将“提供默认参数”设置为“来自 URL 的节点 ID”。
如果 EventId 不是 NID,那么您应该将默认参数设置为 PHP 并给出以下 PHP :
上面的代码将从 URL 中获取参数(URL 应该类似于 www.example.com/events/14555
)我使用 drupal_get_path_alias 是因为你可能已经启用了 pathauto 模块,如果没有,你可以只提供以下 php 。
I believe that you should create a Page View and not a block view. You have to pass a argument. Is Event ID equals to NodeID? If yes then you should add an Argument of type Node:NID and then set "Provide default argument" equals to "Node ID from URL".
If the EventId is NOT the NID then you should set the Default Argument to PHP and give the following PHP :
The above code will take the argument from the URL (the URL should be like www.example.com/events/14555
The reason that I am using the drupal_get_path_alias is because you may have enabled the pathauto module. If not you can just give the following php