Alternate Comment Rows

From Habari Project

Jump to: navigation, search

You can configure your theme to 'style' comment rows differently. By using CSS, this can be used to make comment lists visually easier to differentiate. We can also set a custom CSS class whenever the owner responds.

Here is a sample of this being accomplished:
<?php if( $post->comments->moderated->count ) : 
$class = '';
	<h3 id="comments"><?php echo $post->comments->moderated->count; ?> Responses to &#8220;<?php echo $post->title; ?>&#8221;</h3>
	<ol class="commentlist">
<?php foreach ( $post->comments->moderated as $comment ) :
                // The alternate row change
                $class = (($class == '') ? 'alt' : '');	
                 //check to see if post author email is same as comment author email  
		if( $comment->email == $post->author->email ) {
			$class= 'owner';
		if ( $comment->status == Comment::STATUS_UNAPPROVED ) {
			$class= 'unapproved';
<li id="comment-<?php echo $comment->id; ?>" class="<?php echo $class; ?>">
   <span class="commentauthor"><a href="<?php echo $comment->url; ?>" rel="external"><?php echo $comment->name; ?></a></span>
   <small class="commentmetadata"><a href="#comment-<?php echo $comment->id; ?>" title="Time of this comment">
   <?php echo $comment->date; ?></a> <?php if ( $comment->status == Comment::STATUS_UNAPPROVED ) { ?>
   <em>Your comment is awaiting moderation.</em><?php } ?></small>
   <?php echo $comment->content_out; ?>
<?php endforeach; ?>
<?php endif; ?>
Personal tools
This is a cached copy of the requested page, and may not be up to date.

Sorry! This site is experiencing technical difficulties.
Try waiting a few minutes and reloading.

(Can't contact the database server: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) (localhost))

You can try searching via Google in the meantime.
Note that their indexes of our content may be out of date.