Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4082668
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:12:57+00:00 2026-05-20T18:12:57+00:00

In Drupal 6 (when using Views), by default, each View is wrapped in a

  • 0

In Drupal 6 (when using Views), by default, each View is wrapped in a DIV. This DIV contains a number of classes that describe the name and type of the View.

Is there anyway to output these classes in the body tag?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:12:58+00:00Added an answer on May 20, 2026 at 6:12 pm

    I can’t find a way to access the existing views classes applied to other elements, but I do what the Zen theme does, which is to use the first argument of any URL as a body class e.g. yoursite.com/case-studies would have the body class “page-case-studies”. This normally does the trick, as it is often set to be the title of the view. It can also easily be adapted/customised for specific cases.

    You can achieve this with 3 lines in your THEME_preprocess_page() function, in your theme’s template.php:

    $path = drupal_get_path_alias($_GET['q']);
    list($title, ) = explode('/', $path, 2);
    $vars['body_classes'] .= " ".drupal_html_class("page-".$title);
    

    For more functionality, you can just download the Zen theme, and have a look at their template.php.

    Obviously make sure that your page.tpl.php is printing $body_classes. Also to use this on Drupal 6, you need to copy the drupal_html_class() function, which is also included in Zen’s template.php.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Drupal 6, I'm trying to create a page with views that shows something
I'm using Drupal, Views with a exposed filter (using taxonomy). My customer wants to
I'm working on a Drupal 5.x book-selling site and using the Views Fast Search
I'm using Drupal 6.x and I'm writing a php class that will grab an
I have a Drupal view which should output a video player using flash. I
I'm using the Drupal views module to create an overview of nodes. In the
I am using the node id as an argument in a drupal view. However,
I'm using the Drupal 6 Views module to request for top nodes rated using
When using views without Ajax, it's easy to access the $view->result array using hook_views_pre_render().
When using views without Ajax, it's easy to access the $view->result array using hook_views_pre_render().

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.