Incorrect "paginate()" rendering in Kirby 2.4.x?

In Kirby 2.3.2 (online version), with a snippet “blog.latest.home” (see below) set to “paginate(8)”, I get 8 latest posts on a home page as expected.
In Kirby 2.4.x (localhost version), with the same snippet and settings, I get only 3 latest posts…

…with “paginate(12)”, I get 5 posts…
…with “paginate(16)”, I get 9 posts…

Any tips ?

The snippet “blog.latest.home” code is :

    <?php  /*** article overview ***/
    	$articles = $pages->find('blog')
    					->children()
    					->visible()
    					->flip()
    					->paginate(8);
    ?>

    <?php
    $i = 0 ; 
    foreach($articles as $article): ?>
    <?php if($article->template() == 'post'): ?>
    <?php $i = $i + 1 ?>
    					<!-- Article <?= $i ?> -->
    					<article class="isotope-item image">
    						<a href="<?php echo $article->url() ?>" class="post-wraper">
    							<div class="post-format <?php echo html($article->posttype()) ?>-post"></div>
    							<div class="post-content">									
    								<div class="post-date">
    									<time datetime="<?php echo $article->date('c') ?>">
    	<?php echo $article->date('Y-m-d'); ?></time>
    								</div>
    								<div class="post-title"><?php echo html($article->title()) ?></div>
    							</div>
    						</a>
    					</article>
    					<!-- End Article <?= $i ?> -->
    <?php endif ?>
    <?php endforeach ?>

ps.
Still hoping KIrby 2.5 will solve a mulitilingual sites problem with templates.

I don’t really know why this fails (would need more information like the template and controller where the snippet is used), but for just fetching the 8 latest posts, the paginate() method is not the right method to use, anyway. Use limit(8) instead.

Hi, Texnixe
as usual you’re very responsive, thanks.

  • Limit() is better then paginate(). I changed.
  • There is no controller for my home page.

I guess the problem comes from a different approach of code by newer Kirby (but that the initial conflict may lay somewhere in my code, not necessarily at the level of the one you see below).

Full snippet code (previously it was just a part of it) :

<?php  /*** article overview ***/
	$articles = $pages->find('blog')
					->children()
					->visible()
					->flip()
					->limit(8);
?>

<!--IF POST -->
<?php $i = 0 ; foreach($articles as $article): ?>
	<?php if($article->template() == 'post'): ?>
		<?php $i = $i + 1 ?>
		<!-- Article <?= $i ?> -->
		<article class="isotope-item image">
			<a href="<?php echo $article->url() ?>" class="post-wraper">
				<div class="post-format <?php echo html($article->posttype()) ?>-post"></div>
				<div class="post-content">									
					<div class="post-date">
						<time datetime="<?php echo $article->date('c') ?>"><?php echo $article->date('Y-m-d'); ?></time>
					</div>
					<div class="post-title"><?php echo html($article->title()) ?></div>
				</div>
			</a>
		</article>
		<!-- End Article <?= $i ?> -->
	<?php endif ?>
<?php endforeach ?>

Home page template blog section is:

<!-- Latest blog section -->
<div>
	<h5><?php echo l::get('site_latestposts') ?></h5>

	<div class="row">
			<div>
				<div class="isotope-container" data-columns="2" data-layout="masonry">
					<?php snippet('blog.latest.home') ?>					
				</div>
			</div>
	</div>
</div>
<!-- Latest blog section end -->

Is there anybody here ? :wink:

Are you trying to tell me that it doesn’t work with limit() either?

Indeed.
limit() instead of paginate() changes nothing (the correction was already visible in the code above).

Any other idea where to look for conflict ?

I can’t spot anything critical in the above code. But if you want, you can send me your project as zip that would make it easier to debug.

That’s very kind of you. But it would need to stay private.