Recent Topics

1 Mar 20, 2006 18:02    

Using this plugin :

<?php 
    
   if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' ); 

    
   $CommentList = & new CommentList( $blog, "'comment'", $show_statuses, '',   '',   'DESC',   '',   7 ); 
    
   $CommentList->display_if_empty( '<div class="bComment"><p>'.T_('No comment yet...').'</p></div>' ); 

   while( $Comment = $CommentList->get_next() ) 
   {   // Loop through comments:   ?> 
      <!-- ========== START of a COMMENT ========== --> 
      <a name="c<?php $Comment->ID() ?>"></a>
      <div class="bCommentinclude"> 
         <div class="bCommentText"> 
         <b><?php $Comment->author( '', '', '', '', 'htmlbody', true) ?> writes:</b><br /> 
         
         <?php $Comment->content() ?></a> <br>
         <em>From - <a href="<?php $Comment->Item->permalink() ?>"><?php $Comment->Item->title( '', '', false ) ?></em><br><br>         
</div> 
      </div> 
      <!-- ========== END of a COMMENT ========== --> 
      <?php 
   }   // End of comment loop. 
?>

To display the last 7 comments - how would I limit the comment length to say 150 characters?

I have seen this question asked a few times, but have not seen the response.

2 Mar 21, 2006 15:08

put this in your css file

div.bCommentinclude /* Entire comment block */
{ 
	margin: 0ex 2ex 0ex 0;
	padding: 1em 1ex 1em 0;
	height: 4em;
	overflow: hidden;
}
div.bCommentincludeauthor /* Entire comment block */
{ 
	font-size: 0.9em;
	width:200px;
	height: 1.3em;
	overflow: hidden;
}

3 Mar 21, 2006 18:14

how does that limit the amount of characters that displays? I don't have an issue wit the size of the font.

4 Mar 21, 2006 19:57

Well, since I saw you were using the same plugin as I did, I tought you wanted the same sollution as I use on my site...

5 Apr 11, 2006 03:05

Well I guess that Topanga's reply would just hide the extra characters ;)

I'm not a php programmer, but the function you need to use is substr($string, $start, $end). I guess that your code should look something like this:

<?php substr($Comment->content() , 0 , 150 ) ?></a> <br>
<em>From - <a href="<?php $Comment->Item->permalink() ?>"><?php $Comment->Item->title( '', '', false ) ?></em><br><br>

--
Richard


Form is loading...