b2evolution b2evolution

  • Sign in
  • Sign up
  • About
  • Downloads
  • Hosting
  • Docs
  • Support
  • Sign in
  • Sign up
  • Manuals Home
  • Latest Updates
 
  1. b2evolution CMS User Manual
  2. Developer Reference
  3. How to... (Customize)
  4. Recent Comments In The Sidebar

Recent Comments In The Sidebar

Recent comments plugin

The easiest way to accomplish this is to use the Sidebar comments plugin.

For version 1.8.1

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

the content of that file (here I want to show 5 comments)


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

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

	while( $Comment = $CommentList->get_next() )
	{	// Loop through comments:
		$Comment->get_Item();	?>
		<!-- ========== START of a COMMENT ========== -->
		<a name="c<?php $Comment->ID() ?>"></a>
		<div class="bCommentinclude">
			<div class="bCommentText">
			<?php $Comment->Item->permanent_link('#title#') ?>&nbsp;:&nbsp;
			<?php $Comment->author( '', '', '', '', 'htmlbody', true) ?><br />
			<div style="cursor:pointer" onclick='window.location="<?php echo $Comment->get_permanent_url(); ?>"'><?php $Comment->content(); ?></div>
			</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;
}
Created by fatimahnasra • Last edit by fplanque on 2020-06-09 00:24 • •

No feedback yet

On this page

  • Recent comments plugin
  • For version 1.8.1

Search the Manual

Content Hierarchy

  • b2evolution CMS User Manual
  • User's Guide
  • Installation / Upgrade
  • Front-office Reference
  • Back-office Reference
  • Developer Reference
    • Website Skins/Themes
    • Email Skins/Themes
    • b2evolution Files
    • Website Integration
    • Plugins
    • Debugging
    • Technical Reference
    • Hacks
    • Credits
    • Development
    • How to... (Customize)
      • How to upgrade a b2evo blog template to an evoSkin
      • Popup Comments
      • FTP 101: How to upload and manage files on your web server
      • Working with the Open Graph Protocol
      • How to - Use "honeypots" in your forms
      • I made a change but my blog is not updated
      • Turn A Skin Into A Template
      • Where is the Templates Tab?
      • Display Recent Posts In The Sidebar
      • Recent Comments In The Sidebar
      • Include Item Feedback
      • How to display comments, trackbacks and pingbacks UNMIXED
      • Change the way my blog looks
      • How to use b2evolution as a CMS
      • How to Show the Assigned Author of a post
      • How to change the "Read More" link
      • How to call a blog through xyz.php instead of index.php?blog=x
      • How to turn a Skin into a Template
      • How To use Pop-Up Comments in your evoSkin
      • How to add a smilie to your toolbar
      • How to display the posts' author
      • Dev Menu
    • Scheduled Tasks Reference
  • Operations Reference
  • Advanced Topics
  • Glossary
  • Archives
powered by b2evolution

This online manual is powered by b2evolution CMS – A complete engine for your website.

About b2evolution

  • What is it?
  • Features
  • Getting Started
  • Screenshots
  • Online demo
  • Testimonials
  • Design philosophy
  • Free & open source
  • Terms of service

Downloads

  • Latest releases
  • Skins
  • Plugins
  • Language packs

About us

  • About us
  • Contact

Webhosting Guide

  • Web hosting blog
  • Best web hosting
  • Cheap web hosting
  • Green web hosting
  • Hosting with SSH
  • VPS hosting
  • Dedicated servers
  • Reseller hosting
  • Int'l: UK / France

Docs & Support

  • Online manual
  • Forums
  • Hire a pro !

Other

  • Adsense
  • Press room
  • Privacy policy

Stay in touch

  • GitHub
  • Twitter
  • Facebook
  • LinkedIn
  • News blog
  • RSS feed
  • Atom feed

Founded & Maintained by François Planque