- b2evolution CMS Support Forums
- b2evolution Support
- General Support
- [1.10.2] Recent posts in sidebar issue
1 jibberjab Jun 14, 2007 00:13
My b2evolution Version: 1.10.2
I'm building a template for a 1.10.2 installation. In the sidebar, I've got the standard "archives" reference code which looks like this:
<?php
// -------------------------- ARCHIVES INCLUDED HERE -----------------------------
// Call the Archives plugin:
$Plugins->call_by_code( 'evo_Arch', array( // Add parameters below:
) );
// -------------------------------- END OF ARCHIVES ----------------------------------
?>
It displays the generic list of archives as:
June (7)
More...
I want to display a list of the most recent 5 posts from each blog before the Archives list. If I place the following block of code before the archives code I pasted above:
<?php // --------------------------- BLOG LIST -----------------------------
for( $blog=blog_list_start();
$blog!=false;
$blog=blog_list_next() )
{ # by uncommenting the following lines you can hide some blogs
if( $blog == 1 or $blog == 3 or $blog == 4) continue; // Hide blog 1...
?>
<h4><?php blog_list_iteminfo( 'name', 'htmlbody'); ?></h4>
<ul>
<?php // Get the 5 last posts for each blog:
$BlogBList = & new ItemList( $blog, '', '', '', '', '', array(), '', 'DESC', '', 5, '', '', '', '', '', '', '', 'posts' );
while( $Item = $BlogBList->get_item() )
{
?>
<li lang="<?php $Item->lang() ?>">
<?php $Item->issue_date() ?>:
<?php $Item->permanent_link( '#title#' ) ?>
</li>
<?php
}
?>
<li><a href="<?php blog_list_iteminfo('blogurl', 'raw' ) ?>" title="<?php echo T_('View more posts...') ?>"><?php echo T_('View more posts...') ?></a></li>
</ul>
<?php
}
?>
then both blocks still work, BUT the only thing that appears from the Archives code is the "More..." link. The "June (7)" link no longer appears... I'm assuming that if I had more months in the archive, none of them would appear either. As soon as I remove the "Most recent posts" code, the individual months from the Archives code reappears. Anyone know why the individual months would not display, but the "More..." link still would?
jj.
Another side-effect of the "Recent Posts" code from above is that if I enable the Star Rating plugin, I get this error in the sidebar:
Additional information about this error:
MySQL error!
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND evo_plugin_starrating_20_ratings.id = evo_posts.post_ID AND total_votes >' at line 7(Errno=1064)
Your query:
SELECT DISTINCT post_ID , post_urltitle ,
total_value / total_votes AS rating, total_votes
FROM ( evo_posts , evo_plugin_starrating_20_ratings)
INNER JOIN evo_postcats ON post_ID = postcat_post_ID
INNER JOIN evo_categories ON postcat_cat_ID = cat_ID
WHERE cat_blog_id =
AND evo_plugin_starrating_20_ratings.id = evo_posts.post_ID
AND total_votes >= 2
ORDER BY `rating` DESC
LIMIT 5
But as soon as I remove the "Recent Posts" code, this error disappears and the Star Rating plugin functions properly, as does the "Archives" code as I described in the first post. Any suggestions? Or does anyone have a working "Recent Posts" code for the sidebar I could try out?
jj.