Skip to content

How do I create a pagination in a layout file? #854

Discussion options

You must be logged in to vote

You are 50% there, just call layout("pagination") with paginated pages. When you call it with pages that have not been paginated, it doesn't know what to do. Make a page collection, store it in a variable, use the variable in the foreach loop and the pagination.

Layout file for showing latest pages with pagination:

<?php $this->yellow->layout("header") ?>
<div class="content">
<div class="main" role="main">
<h1><?php echo $this->yellow->page->getHtml("titleContent") ?></h1>
<?php $pages = $this->yellow->content->index()->sort("modified", false)->paginate(10) ?>
<?php $this->yellow->page->setLastModified($pages->getModified()) ?>
<ul>
<?php foreach ($pages as $page): ?>
<li><?php echo $pag…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PetersOtto
Comment options

Answer selected by PetersOtto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants