I have a view which displays nodes from different content types. I need each row to have a css class corresponding to its content type so different content types have distinct css styles.

Thank you for your help!
Jane

Comments

anruether’s picture

I have a similar problem: I give out fields from a view which makes it possible to add the content type as a field. This allows you to use the rewrite and substitution patterns in the settings of the field.
But for me this solution does not work because there is only the human readable name available as substitution pattern [type] . Also this only makes it possible to output something like That doesn't give you much...
Hope somebody else has a better idea!

anruether’s picture

Hu, i guess we have to head for the template files

anruether’s picture

This might bring us a bit further... http://drupal.org/node/991084

Jane_dev’s picture

Yeah I looked at that thread but it didn't seem to give me a definitive answer... however, I did find this video extremely helpful:

http://mustardseedmedia.com/podcast/episode30

anruether’s picture

You should take a look at Semantic Views http://drupal.org/project/semanticviews . That seem to solve such issues. Some of its functionality has made it into Views 3 what I am using. There you can easily add a row class using the Replacement Patterns. The only drawback is that I still don't get the machine-readable name of the content type.

[edit] the later issue is dealt with in http://drupal.org/node/1262630