Add a class to a row in a view i'm trying to create a module that adds a 'new' class to a row based on the date it was published.

So i thought of doing something like 

if ($data &gt; 10 days ago){
  $this_row addclass new
}


But whats the best way to do this? I would like to put this in a module so i can simply turn it on and off and avoid problems with template files from ds.

I can only find a way using hook_views_pre_render to add a class to all the rows, but nothing about adding it to one specific row. Maybe i need to use another hook?
Writing a view handler would be the perfect way to do this. The handler itself will be almost as simple as your example code.

However getting everything right to get the handler called from views isn't easy. A good example to learn from is the maillog module. It integrates its log table with views and adds a custom handler.