New Comment/Reply Comment Page CSS

Events happening in the community are now at Drupal community events on www.drupal.org.
vas01's picture

Hi everybody,

I am relatively new to Drupal. I am trying to theme the "create comment" or "reply to comment" pages of my website, but can't seem to manage this. There doesn't seem to be any CSS class for these pages as a whole. I need a class which comes before all other ones, just after HTML. Optimally I would like to create a CSS class that is in the BODY which applies to all of the reply and add comment pages.

To better help everyone understand which pages I am talking about, here are the example URL's of them:
http://example.com/comment/reply/4/2
http://example.com/comment/reply/27#comment-form

I would like these pages to look much different from the rest of my website and match the unique look I have assigned to my #pid-node-add pages, which I have done one by one for each node type. The way I have done it for those pages would be impossible to use for comment pages.

Sorry if my writing is kind of hard to understand. I have been sitting on the computer way too long today.

Thanks,
Vassili

AttachmentSize
pages-css.png9.14 KB

Comments

Hello Vasiliy, There is more

alexrayu's picture

Hello Vassili,

There is more than one way to theme a comment.

  1. There are some tpl.php files in your /modules/comment folder that you can copy to your theme folder and edit.
  2. There are modules like WordPress Comments that can do some styling for you.
  3. There are base themes like Zen, Fusion, and AdaptiveTheme that provide additional classes to comments to allow better styling them.
  4. There are tutorials how to implement advanced styling of comments for Drupal 6, some of which are
    http://www.digett.com/2010/06/29/how-theme-comment-form-drupal-6 and
    http://drupal.org/node/384124

Still Confused

vas01's picture

Hey Alexei,

I looked over the links you have sent, but still can not get the desired effect I am aiming for.
I am using the forum module on my website as well and it creates a forum class inside the BODY which applies to all pages that are the forum. So in my CSS I can put BODY.forum and it applies to all pages.
I looked through all of the forum module and advanced forum module php files and can not see were this class is coming from. I would like to send this sort of thing all the pages which create new comments, not the comment form on the bottom of node pages.

Maybe I missed something while reading, but it seemed to all be about the comment form.
I attached an image to my original post.

Thanks,
Vassili

If you are interested with

alexrayu's picture

If you are interested with overriding the body classes you should have a look at theme_preprocess_page() function. You can use it in this way:

<?php
function mytheme_preprocess_page(&$vars) {
 
  global
$language, $theme_key, $theme_info, $user;
 
 
// Add to array of helpful body classes
 
$body_classes = explode(' ', $vars['body_classes']);
 
  if(
arg(2)=='edit' || arg(1)=='add' || arg(0)=='admin'){
     
$body_classes[] = ('sadmin');
  }

 
$body_classes = array_filter($body_classes);
 
$vars['body_classes'] = implode(' ', $body_classes);
}
?>

Thanks for quick reply

vas01's picture

I have found the similar section in my template.php, but have no idea how to insert the code you have provided. I can see the forum BODY class in there.
Sorry I have no clue what i'm doing when it comes to php, I think I actually need to completely learn it to fully get along with Drupal.

Ideally I would like to have a body class for all my create a node pages and create a comment/reply to a comment pages.

I'm using the latest Acquia Marina theme.

Thanks,
Vassili

Right Direction

vas01's picture

Thanks for pointing me in the right direction. I had problems directly editing the template.php file so I found a module called Themer. It generated body classes based on the path for me. So i was able to accomplish what I was after.

Thanks,
Vassili

Ok cool! Hope you enjoy using

alexrayu's picture

Ok cool! Hope you enjoy using Drupal and ulneash its power. It's worth learning.

My site is set up configured

adamto's picture

My site is set up configured to show comments in the node page. But when submit a invalid comment it redirects to the reply page. What to do?
Thanks,
Adam Gottbetter

Theme development

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week