Zen very helpfully adds body_classes for node types (node-type-page, node-type-story, etc.). I propose the addition of similar classes for identifying and distinguishing Views-generated pages from others. For example, one group of such classes might expose the system responsible for the page: page-source-node, page-source-views, page-source-panels, page-source-system. Another might identify the specific View: view-vid-123 or view-viewname or view-viewname-page_1. I realize Views already supplies IDs and classes on a View itself, but sometimes I want to style differently something outside the view—the page header or something—on a specific View or display. I guess we'll see what everyone else thinks. :)
Comments
Comment #1
mattiasj commentedI need exactly the same thing since some of my views-generated pages need different css than others. Is this possible already using preprocess function in body_classes?
Comment #2
grasmash commentedsubscribe
Comment #3
Sinan Erdem commentedHave a look at: http://drupal.org/node/707410
Code goes into template.php file...
Comment #4
mattiasj commentedThanks. That code will check for a menu item, but in certain cases you have views pages without menus, for example term views and for those the code won't work.
Comment #5
johnalbinIt doesn't check for a menu link, it checks the menu router. Those are separate things.
I'm not adding new features to the 6.x-1.x branch, but you can copy that code from Zen 6.x-2.x's template.php and put it in your 6.x-1.x-based sub-theme.
Comment #6
mattiasj commentedThanks JohnAlbin, I will try it out!