2 village_idiot Apr 13, 2005 10:59

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.
:)
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 ;)
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 ) ?> :
<?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;
}
: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!
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
Anyone know of a way to cut the length of the comments as they appear in the sidebar?
*bump*
Like excerpts of the latest comments with links to the actual comment? Like on my site?
I swear I saw that somewhere on here, and for the life of me cant find it. I did find it on edb's site though .. see if this: http://wonderwinds.com/hackblog.php/2005/01/05/recent_comments_hack#more493 is what you want