I have a solution for both problems. It was because of a faulty design of a couple of functions in the core. Please Mikeh, add this to the main distribution so others don't have to scratch their heads like me
. Here's the code of both functions I had to modify. I want to thankyou of course for this plugin!:
// show_posts_page
function show_posts_page($index=0)
{
$Blog = new Blog;
$posts = $Blog->listPosts(true, true);
if($Blog->getSettingsData("allpostsadtop") == 'Y')
{
?>
<div class="blog_all_posts_ad">
<?php echo $Blog->getSettingsData("addata"); ?>
</div>
<?php
}
if(!empty($posts))
{
$pages = array_chunk($posts, intval($Blog->getSettingsData("postperpage")), TRUE);
if (is_numeric($index) && $index >= 0 && $index < sizeof($pages))
{
$posts = $pages[$index];
}
else
{
$posts = array();
}
$count = 0;
$lastPostOfPage = false;
foreach ($posts as $file)
{
$count++;
show_blog_post($file['filename'], true);
if($count == sizeof($posts) && sizeof($posts) > 0)
{
$lastPostOfPage = true;
}
if (sizeof($pages) > 1)
{
// We know here that we have more than one page.
$maxPageIndex = sizeof($pages) - 1;
show_blog_navigation($index, $maxPageIndex, $count, $lastPostOfPage);
if($count == $Blog->getSettingsData("postsperpage"))
{
$count = 0;
}
}
}
}
else
{
echo '<p>' . i18n(BLOGFILE.'/NO_POSTS') . '</p>';
}
if($Blog->getSettingsData("allpostsadbottom") == 'Y')
{
?>
<div class="blog_all_posts_ad">
<?php echo $Blog->getSettingsData("addata"); ?>
</div>
<?php
}
}
// show_blog_navigation
function show_blog_navigation($index, $total, $count, $lastPostOfPage)
{
$Blog = new Blog;
$url = $Blog->get_blog_url('page');
if ($lastPostOfPage)
{
echo '<div class="blog_page_navigation">';
}
echo $needsNavigationDiv;
//if ($index < $total && $count >= $Blog->getSettingsData("postperpage"))
if($index < $total && $lastPostOfPage)
{
?>
<div class="left">
<a href="<?php echo $url . ($index+1); ?>">
← <?php echo $Blog->getSettingsData("previouspage"); ?>
</a>
</div>
<?php
}
?>
<?php
//if ($index > 0 && $count >= $Blog->getSettingsData("postperpage"))
if ($index > 0 && $lastPostOfPage)
{
?>
<div class="right">
<a href="<?php echo ($index > 1) ? $url . ($index-1) : substr($url, 0, -6); ?>">
<?php echo $Blog->getSettingsData("nextpage"); ?> →
</a>
</div>
<?php
}
?>
<?php
if ($lastPostOfPage)
{
echo '</div>';
}
}