- b2evolution CMS Support Forums
- b2evolution Support
- Plugins & Extensions
- [Plugin] Sidebar comments
1 personman Nov 22, 2005 15:39
This plugin is for the Phoenix version of b2evolution. It's very simple. It displays the most recent comments in the sidebar of a blog. The comment author name is given, followed by the title of the post, which is a permalink to the comment on that post. It uses the code from the _lastcomments.php file in the skins folder, but it provides a quicker look at who is commenting on what.
If you're running the unreleased version (or reading this in the future when it has been released), here's how to install:
1. Download the plugin file: [url=http://www.brendoman.com/images/danny/_sidebarcomments.plugin.php.txt]_sidebarcomments.plugin.php.txt[/url] and remove the .txt from the end of the filename.
2. Place it in your plugins directory, then go to the back office, Settings->Plugins and click install next to Sidebar Comments.
3. Copy this code into your evoskin where you want the comments to appear:
<?php
// -------------------------- SIDEBAR COMMENTS INCLUDED HERE --------------------------
// Call the Sidebar Comments plugin:
$Plugins->call_by_code( 'SBcommnt', array(
// Add parameters below:
// 'n_comments'=>5
) );
// -------------------------- END OF SIDEBAR COMMENTS -------------------------------
?>
You can uncomment the 'n_comments'=>5 line to change the number of comments that are displayed. You can also add other values to the array to customize the way things are displayed. See the plugin file for more information.
If you want to be minimalist, then you can use this instead of the code block above:
<?php $Plugins->call_by_code( 'SBcommnt', array() ); ?>
I'm still trying to get the feel for the right way to put a plugin together, so if you find any mistakes, please let me know. I'm hoping to work my way up to more complicated things.
YaBBa already has a very similar plugin ready to go. There are a few more params in that one and it displays things a little differently. It, along with the others YaBBa's making won't be released until Phoenix is out. This was a good learning experience for me, though. If looking at the code helps you at all, then all the better.