Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

Categories

In this Discussion

Who's Online 14

6apxatCurtisOdenHotBlackericgilletteesttc74422 +7 guests

Alter first comment?

Is there a method to change the look of the first comment in a discussion? I mean the post of the one who started the discussion.

Comments

  • Posts: 2,301
    If you check the RowNumber delegate parameter, it will tell you if you are looking at the first comment or not:

    $Context->SetDefinition('AfterFirstPostCode', '<hr style="border: 0 1 #ccc" />Insert code here');
    $Context->SetDefinition('AfterLastPostCode', '<hr style="border: 0 1 #ccc" />Insert code here');

    function TweenPost(&$CommentGrid) {
    // Insert the ad code after the last </li>
    $CommentList = &$CommentGrid->DelegateParameters['CommentList'];
    $RowNumber = &$CommentGrid->DelegateParameters['RowNumber'];
    $Comment = &$CommentGrid->DelegateParameters['Comment'];

    if ( 1 == $RowNumber ) {
    $Comment->Body .= $CommentGrid->Context->GetDefinition('AfterFirstPostCode');
    } else {
    if ( ($CommentGrid->CommentDataCount == $RowNumber) || ($CommentGrid->Context->Configuration['COMMENTS_PER_PAGE'] == $RowNumber) ) {
    $Comment->Body .= $CommentGrid->Context->GetDefinition('AfterLastPostCode');
    }
    }
    }

    $Context->AddToDelegate('CommentGrid', 'PreCommentOptionsRender', 'TweenPost');
  • TexTex
    Posts: 261
    Thanks for this code! Where to put it into? I tried some ways but always get an error.
  • Posts: 223
    Tex, Just make a new extension.. or Wallphone can create his own considering how helpful it is.
  • TexTex
    Posts: 261
    Ah, as an extension. I'll try this. Thanks!
  • Posts: 926
    Wasn't there a CSS tag like Comment_First or something? Was it done away with?
  • TexTex
    Posts: 261
    @ Krak:
    I couldn't find any. Neither in the css file nor at the source code of the page.
  • TexTex
    Posts: 261
    All right. This enables me to add anything I want after the text of the first comment. Has anybody an idea how to alter the look of it? I could imagine opening a div before it and close it after the comment. But how to add something before the first comment? Sorry, I am not good in this as you see.
  • Posts: 926
    I could have swore there was something like Comment_First, but I looked and couldn't find it either. It must have been removed or I am blind/looking in the wrong spot.

    I swear I have used it before.
  • Posts: 2,301
    One thing you could do:
    $Comment->Body = '<div class="FirstComment">'. $Comment->Body .'</div>';
    But that would only single out the body of the first comment... Maybe look at the beautiful lie theme if you are trying to get a blog-like appearance.

    There was a FirstComment class in .9.2.6 Not sure why it didin't make it into later versions. (Maybe because you can get the same effect with a :first-child CSS selector?)#Comments li:First-Child {
    border: 2px solid #f00;
    }
    But this seems to do things to the comment author and icon fields... and I am not familiar with how well browsers use it.
  • TexTex
    Posts: 261
    @ WallPhone:
    The first method is very well for the beginning, thanks!
    The 'First-Child' is not supported by IE.
    The Beautiful Lie theme doesn't alter the look of the first comment, as far as I can see.
  • Posts: 2,610
    What about the Adjacent-Sibling Selectr? That should work with IE?
  • did any body ever make any progress on this?
  • TexTex
    Posts: 261
    The method proposed by WallPhone works fine:
    $Comment->Body = '<div class="FirstComment">'. $Comment->Body .'</div>';
    Than you can define the class in you CSS stylesheet.
This discussion has been closed.