[development] Styling comment blocks according to vote results

Ben Campbell ben at scumways.com
Tue Jan 16 12:26:41 UTC 2007

Hi there - I'm working on a system to change the appearance of comments 
based on how people rate them. So highly rated comments would appear 
bigger and brighter than badly-rated comments.

The voting API abstracts away the rating mechanism nicely (so in theory 
you could pick any voting module to drive the ratings system).

But I'm not 100% sure of the best way to apply different looks to 
differently rated comments.

My current thinking is that it'll have to be pretty tied to a theme - 
I'd pass some sort of rating metric into comment.tpl.php as an extra 
parameter and the template applies an appropriate style (probably one of 
a range of styles defined in a stylesheet).

Does this sound like a sane way to do it?
Does anyone have any suggestions of approaches I could take to 
generalise it a little? It'd be nice to decouple it from the theming as 
much as possible so others can take advantage of it.


More information about the development mailing list