Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HOMEPAGE code to paginate ARTICLES in Wolf CMS...
- <?php // set limit value in next line to match per-page value below ?>
- <?php $last_articles = $this->find('/articles')->children(array('limit'=>3, 'offset'=>($pagination->cur_page)*($pagination->per_page), 'order'=>'page.created_on DESC')); ?>
- <?php foreach ($last_articles as $article): ?>
- <div class="entry">
- <h3><?php echo $article->link($article->title); ?></h3>
- <?php // Whatever else you want to include: teaser? meta? etc. ?>
- </div><!-- end .entry -->
- <?php endforeach; ?>
- <?php use_helper('Pagination');
- $pagination = new Pagination(array(
- 'base_url' => '/?page=', // if Wolf is in SUBDIR, but subdir between / and ? - e.g. '/wolf?page='
- 'total_rows' => $this->find('/articles')->childrenCount(),
- 'per_page' => 3,
- 'num_links' => 8,
- 'cur_page' => (isset($_GET['page']) ? $_GET['page']: 1)
- )); ?>
- <?php if ($pagination->total_rows > $pagination->per_page) echo '<p><br />Pages: '.$pagination->createLinks().'</p>'; ?>
Add Comment
Please, Sign In to add comment