Drupal视图显示每天最高评分的节点,每一天一年? [英] A Drupal view to show the top rated node per day, each day for a year?

查看:114
本文介绍了Drupal视图显示每天最高评分的节点,每一天一年?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站与用户生成的故事。故事是节点。故事被评为Fivestar。



我想创建一个日历风格的视图,列出最高评分的故事 - 每一天,当年。所以最后我会列出365个故事。



我不知道该怎么做,任何帮助都会很棒。

解决方案

您可以使View获取Date参数,您将在某个特定日期通过,并返回按Fivestar评级排序的结果,并限制查看到1个结果。



然后在您的自定义日历中,每天循环,每次调用View并显示结果,这将是顶部评分。虽然这可能有点过分,但它适用于显示当前最高评级的节点的Block。我实际上不会使用它一个月甚至一年的视图。



另外一个选择可能是,每24小时 - 过去一个午夜 - 你使用查看以获得前一天的最高评分的音符,并将其存储或标记为最高评分。
这样一来,每天只会有1个节点被标记或存储,您可以构建一个列出按日期排序的所有存储/标记节点的视图。评分在这里是无关紧要的,因为你在Cron跑过的视图已经获得了最高评分。将此视图作为网格主题,也许有一个参数月,而且您将接近每天的顶级评分节点的月历视图。



最后一个选项将要建立一个View,它获取所有节点,并通过评级对它们进行排序,并按日分组。然后确保您只打印1个组,即最高评分。


I have a site with user generated stories. Stories are nodes. Stories are rated with Fivestar.

I want to create a calendar style view to list the top rated story - every day, for the current year. So at the end I will have a list of 365 stories.

I'm not sure how to approach this, any help would be great.

解决方案

You could make a View that takes a Date argument, where you'll pass a specific day', and return results sorted by Fivestar rating, and limiting the View to 1 result.

Then in your custom calendar, loop over every day, and each time, calling the View and showing the result, which will be the 'top rated' note. Though this might be somewhat overkill, it's suitable for a Block which shows today's current top rated Node. I wouldn't actually use it for a whole month or even year view.

Another option could be, that every 24 hours - and a little past midnight - you use that View to get the top rated note for the previous day, and store or flag it as the top rated. That way, only 1 Node a day will be flagged or stored, and you could build a view that lists all stored/flagged nodes, ordered by date. Rating is irrelevant here, since the View you ran in Cron already picked up the top rated one. Theme this View as a grid, and maybe with an argument Month, and you are close to a Calendar like Month view of your top rated Nodes per day.

Last option would be to build a View, which gets all nodes, and sort them by rating, and group them by day. Then make sure you only print 1 per group, namely, the top rated one.

这篇关于Drupal视图显示每天最高评分的节点,每一天一年?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆