Topic: Blog Pagination (Next/Previous) for Morfy CMS
Index Page

Item Page

Installation
1. Download and extract this file, put the nextprev folder with its contents in plugins folder.
2. Update you config.php file:
<?php
return array(
...
...
...
'plugins' => array(
'markdown',
'sitemap',
'nextprev' // <= Activation
),
'nextprev_config' => array( // <= Configuration
'param' => 'page', // <= Page parameter name in URL
'limit' => 5, // <= Number of posts to display per page
'classes' => array( // <= List of item's HTML classes
'page_item' => 'page',
'nav' => 'pager',
'nav_prev' => 'previous',
'nav_next' => 'next',
'nav_disabled' => 'disabled'
),
'labels' => array( // <= List of item's readable text or labels
'nav_prev' => '← Previous',
'nav_next' => 'Next →',
'not_found' => '<div class="alert alert-danger"><p>Not found.</p></div>'
)
)
);Updating Template File
The plugin includes index_nextprev for posts listing page and item_nextprev for individual page.
1. For blog.html, all posts loop will be replaced by the plugin:
<?php include 'header.html' ?>
<?php include 'navbar.html' ?>
<div class="container">
<?php Morfy::factory()->runAction('theme_content_before'); ?>
<?php Morfy::factory()->runAction('index_nextprev'); ?>
<?php Morfy::factory()->runAction('theme_content_after'); ?>
</div>
<?php include 'footer.html' ?>2. For blog_post.html, the plugin will only return as a next/previous navigation:
<?php include 'header.html' ?>
<?php include 'navbar.html' ?>
<div class="container">
<?php Morfy::factory()->runAction('theme_content_before'); ?>
<h3><?php echo $page['title']; ?></h3>
<p>Posted on <?php echo $page['date']; ?></p>
<div><?php echo $page['content']; ?></div>
<?php Morfy::factory()->runAction('item_nextprev'); ?>
<?php Morfy::factory()->runAction('theme_content_after'); ?>
<hr>
</div>
<?php include 'footer.html' ?>