The basic idea would be to "score" the items based on how old they are. Simple division of votes by age in days would be a reasonable start. (10 votes and 1 days, score is 10, 10 votes and 2 days score is 5, etc etc)
You will probably want to throw some form of weighting into the score though to get a nice curve (stays high for the first 5 days, then rapidly falls off unless its up voting exponentially increases). Of course a record starting with 0 votes will never appear at the top no matter the age, so you might need a "base" score to give new items a chance... something like (votes + 100)/age On Thu, Jul 5, 2012 at 5:25 PM, 42startups <[email protected]> wrote: > If I have a feed of content each with a vote count. Any ideas on a basic > sort mechanism to display this? > > Like Reddit, I'd like: > > * the content with the most votes to be toward the top > * but I also don't want old content to remain at the top (e.g. if only > sorting by votes, the feed won't change often) > * but I also want to give new content some airtime toward the top (I don't > want a separate 'new' page like Reddit does) > > > Here's what I'm working with: > > $this->paginate = array( > 'limit'=>30, > 'order'=>array( > 'Story.created'=>'desc', > 'Story.votes'=>'desc' > )); > > Any ideas? > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [email protected] For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
