Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use_helper('Pagination');
- $pagination = new Pagination(array(
- 'base_url' => URI_PUBLIC.'articles',
- 'total_rows' => $this->childrenCount(),
- 'per_page' => 3, // should be the same number as the "limit" four lines below...
- 'num_links' => 8, // sets number of links adjacent to current page before adding first/last links
- 'cur_page' => (isset($_GET['page']) ? $_GET['page']: 1)
- ));
- $last_articles = $this->children(array('limit'=>3, 'order'=>'page.created_on DESC')); ?>
- <?php foreach ($last_articles as $article): ?>
- <div class="entry">
- <h3><?php echo $article->link($article->title); ?></h3>
- <?php echo implode('. ',array_slice(explode('.',$article->content()),0,1)).'. …'; ?>
- <p class="info"><em>Posted by</em> <?php echo $article->author(); ?>
- <?php echo $article->date('at %I:%M %p on %a, %d %b %Y'); ?>.
- <?php if($article->comment_status != 0): ?>
- — <?php echo $num_comments = comments_count($article); ?> comment<?php if ($num_comments != 1) { echo 's'; } ?>
- <?php endif; ?>
- <em>tags:</em>
- <?php $i = 1; foreach($article->tags() as $tag){ ?>
- <a href="<?php echo BASE_URL . 'tags/' . $tag . URL_SUFFIX; ?>"><?php echo $tag; ?></a><?php echo $i == count($article->tags()) ? '.' : ', '; $i++ ?>
- <?php } ?>
- </p>
- </div><!-- end .entry -->
- <?php endforeach; ?>
- <?php
- if ($pagination->total_rows > $pagination->per_page) echo '<p><br />Pages: '.$pagination->createLinks().'</p>'; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement