I have a content type article with a field called 'type'. Based on the value of this field I want to display my content type differently in a view that I created with the Views module. In order to do that I would like to add the value of the type field as a css class to each item in that view.
You have several solutions, you can create a contextual filter based on
type and embed your view with this code
views_embed_view('yourview','page',$field['type']) in this way a special view based on this filter will be loaded.
the second solution is to create separate pages for different types, for example page_type1, page_type2 and ... , then in this code
views_embed_view use the relevant
page based on the
I've used both methods and it works
I believe the Semantic Views module supports tokenized classes. Here is the module description:
This Views plugin makes unformatted styles, field row styles and other output more readily configurable without needing to override template files. Instead of overriding row style templates for views where you want to specify different HTML elements (tags) and class attributes, you can specify these inside the Views UI and avoid overriding templates for each view.