在 Drupal 6 中,有没有办法将最新帖子中的自定义字段转换为分类术语,并将其显示在视图中?
这个问题的标题几乎概括了我要问的内容。
我有一个分类术语列表,并且我正在使用一个视图来显示每个分类术语的最新帖子。我还想在其下方显示 CCK 中设置的自定义字段。
目前,我只是使用分类术语本身的“更新日期”,这很容易在视图中设置。我想更深入地研究一下,并获取我已添加到上次发布到我正在“查看”的分类术语的内容类型中的自定义“事件日期”字段。
我有一种感觉,我必须为此编写自己的数据库查询。
如果(我可以避免这种情况){ 我如何设置这样的视图? } 别的{ 将较低级别的数据库查询与视图一起包含的最佳实践是什么? }
The title for this question pretty much sums up what I'm asking.
I've got a list of taxonomy terms, and I'm using a view to display the latest post to each one. I'd like to also display a custom field set up in CCK just under this.
Currently, I'm just using "date updated" of the taxonomy term itself which was easy to set up in views. I'd like to drill a little deeper and get the custom "event date" field I've added to the content type last posted to the taxonomy term I'm "viewing".
I've got a feeling I'm going to have to write my own database query for this.
If (I can avoid that){
How do I set up such a view?
}
Else{
What's the best practice for including lower level database queries alongside views?
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于视图使用行样式而不是节点样式,并使用自定义模块构建所需的视图外观怎么样?这可以让您将所需的字段发送到页面,然后按照您的意愿主题化它们。
what about using row style instead of node style for your view, and building the desired look of the view with a custom module? this would let you send the fields you want to the page and then theme them however you wish.
请在 drupal.org 上查看此问题:http://drupal.org/node/193187。从技术上讲,SQL 不允许您执行分组查询并为每个组设置限制。可以执行分组查询并仅在主题级别显示每组的第一个查询。然而,根据节点的数量,这可能不会表现得太好 - 我不确定。
See this issue on drupal.org: http://drupal.org/node/193187. Technically, SQL does not allow you do a grouped query and set a limit per group. It would be possible to execute a grouped query and only display the first of each group on the theme level. However, depending on the number of nodes, that might not perform too well - I'm not sure.