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'];
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.
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.
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.
@ 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.
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.
Comments
$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');
I couldn't find any. Neither in the css file nor at the source code of the page.
I swear I have used it before.
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.$Comment->Body = '<div class="FirstComment">'. $Comment->Body .'</div>';
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 {But this seems to do things to the comment author and icon fields... and I am not familiar with how well browsers use it.border: 2px solid #f00;
}
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.
$Comment->Body = '<div class="FirstComment">'. $Comment->Body .'</div>';Than you can define the class in you CSS stylesheet.