Recent Topics

1 Apr 13, 2005 09:06    

Hi there....

How do i make the comments appear on the main page under the comments section itself instead of having to click on "recent comments" which then takes you to the comments page?

I tried using the search but didn't come up with anything.

Thanx in advance :D

3 Apr 13, 2005 13:32

inverse wrote:

How do i make the comments appear on the main page under the comments section itself instead of having to click on "recent comments" which then takes you to the comments page?

If a list of last 5 (or any other number) comments is what you want, [url=http://forums.b2evolution.net/viewtopic.php?t=2110]Last commented posts[/url] hack is what you need.

That is a thread for the hack - there are couple of versions by me and EdB.

4 Apr 13, 2005 23:49

:)

Thanx a ton for your help guys!

But what i really wanted was that the last 5 or 10 comments themselves:

eg::

harry said:
blah blah yeh true

sheila said:
my my yeh yeh solong and stuff

.. and so on...

I'd like the comments to actually diplay..

Hope you guys can help me on this one!! Thanx for the help once again. I really appreciate it ;)

5 Apr 14, 2005 00:18

It is not THAT difficult....

Make a new file in 'your skin' directory and call it whatever you want (in my example _includecomments.php)

the content of that file


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

	
	$CommentList = & new CommentList( $blog, "'comment'", $show_statuses, '',	'',	'DESC',	'',	5 );
	
	$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">
			<?php $Comment->author( '', '', '', '', 'htmlbody', true) ?><br />
			<a href="<?php $Comment->Item->permalink() ?>"><?php $Comment->Item->title( '', '', false ) ?>&nbsp;:&nbsp;
				<?php $Comment->content() ?></a>
			</div>
		</div>
		<!-- ========== END of a COMMENT ========== -->
		<?php 
	}	// End of comment loop.
?>

in your _main.php file, in the sidebar (or where-ever you want to put those comments, you put this :


<div class="bSideItem">
<h3><?php echo T_('Last Comments') ?></h3>
<?php require( dirname(__FILE__).'/_includecomments.php' );	 ?>
</div>

and add this to 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;
}

6 Apr 14, 2005 00:53

:p Thanx. That was what i needed.. Im sure its not THAT tough but i really don't know any of php :oops:

Thanx once again! Appreciate the help :lol: cheers!

7 Jun 14, 2005 23:27

Thanks for the code.

I wonder if there is a PHP-way to cut the length of the comment after 80 characters.

substr("$Comment->content()", 0, 80); 

This does not work.

But I hope you get the idea? ;)

cu,
Holger

http://blog.holger-dieterich.de

8 Feb 23, 2006 21:18

Anyone know of a way to cut the length of the comments as they appear in the sidebar?


Form is loading...