I need to be able to sort videos in views by viewcount, so I can make blocks with 'popular videos'. This data is saved within the field_video_video_data.
Currently I take the following approach:
1. Store viewcount in a separate column
- add a columns for viewcount using this approach: http://drupal.org/node/1681920
2. Update video data
It seems that the data is only updated when the node is saved.
Since viewcount will change over time I need some way to update this at least daily.
I can think of 2 different options:
- writing some custom code that uses cron.
- use the rules module to update the field
I am not an experienced php coder for drupal, so I will choose whatever works.
But any input/feedback/guidance on my approach is welcome.
Comments
Comment #1
workplaysleep commentedI wrote a simple module to daily update the data on all my nodes of the type video.
This together with the extra column for the viewcount works for me.
Probably not the most elegant code/solution but it works for me.
Comment #1.0
workplaysleep commentedremoved some unnecessary words