Skip to content

Instantly share code, notes, and snippets.

@snetty
Created November 8, 2013 09:59
Show Gist options
  • Save snetty/7368844 to your computer and use it in GitHub Desktop.
Save snetty/7368844 to your computer and use it in GitHub Desktop.
lemonstand pagination usage
<?
$page_index = $this->request_param(-1, 1) - 1;
$records_per_page = 5;
$pagination = $posts->paginate($page_index, $records_per_page);
$posts = $posts->find_all();
?>
<? if($posts->count() != 0) : ?>
<div class="post_list">
<? foreach ($posts as $post): ?>
<? $this->render_partial('blog:post', array('post' => $post, 'base_url'=>$base_url, 'post_designation' => $post_designation)); ?>
<? endforeach ?>
</div>
<? if($pagination) : ?>
<? $this->render_partial('pagination', array('pagination'=>$pagination, 'base_url'=>$base_url, 'post_designation' => $post_designation)); ?>
<? endif; ?>
<? else : ?>
<p>Sorry there are no articles to show you.</p>
<? endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment