</div> <?php /* blog.tpl:9: {/foreach} */ } } ?> </div> <?php /* base.tpl:27: {Morfy::runAction('theme_content_after')} */ echo Morfy::runAction('theme_content_after'); ?> </div> <div id="footer"> <div class="container"> <p class="text-muted pull-right">Powered by <a href="http://morfy.org" title="Simple and fast file-based CMS">Morfy</a></p> </div> </div> <script src="<?php /* base.tpl:36: {$.site.url} */ echo $tpl->getStorage()->site_config["url"]; ?> /themes/<?php /* base.tpl:36: {$.site.theme} */ echo $tpl->getStorage()->site_config["theme"]; ?> /assets/js/jquery.min.js"></script> <script src="<?php /* base.tpl:37: {$.site.url} */ echo $tpl->getStorage()->site_config["url"]; ?> /themes/<?php /* base.tpl:37: {$.site.theme} */ echo $tpl->getStorage()->site_config["theme"]; ?> /assets/js/bootstrap.min.js"></script> <?php /* base.tpl:38: {Morfy::runAction('theme_footer')} */ echo Morfy::runAction('theme_footer'); ?> </body> </html> <?php }, array('options' => 16576, 'provider' => false, 'name' => 'blog.tpl', 'base_name' => 'blog.tpl', 'time' => 1445769054, 'depends' => array(0 => array('base.tpl' => 1445769054, 'blog.tpl' => 1445769054)), 'macros' => array()));
// Get current URI segments $path = Url::getUriSegments(); array_pop($path); $path = implode('/', $path); // Get all posts $all_pages = Morfy::getPages($path, 'date', 'DESC', array('404', 'index')); // Count total posts $total_pages = count($all_pages); // Get current page path $current_path = Url::getUriString(); // Get current page data $current_page = Morfy::getPage($current_path); // Testing... // echo $current_page['date']; // Find next and previous link from current page $prev_page = $next_page = false; for ($i = 0; $i < $total_pages; $i++) { if ($current_page['date'] == $all_pages[$i]['date']) { $prev_page = isset($all_pages[$i - 1]['url']) && !empty($all_pages[$i - 1]['url']) ? $all_pages[$i - 1]['url'] : false; $next_page = isset($all_pages[$i + 1]['url']) && !empty($all_pages[$i + 1]['url']) ? $all_pages[$i + 1]['url'] : false; } } unset($all_pages); // Pagination $nextprev_template->display('nav.tpl', array('config' => $nextprev_config, 'current' => 1, 'total' => $total_pages, 'prev' => $prev_page, 'next' => $next_page)); }); // Conditional action between `index_nextprev` and `item_nextprev` Morfy::addAction('nextprev', function () { $path = trim(Url::getUriString(), '/'); Morfy::runAction((file_exists(PAGES_PATH . '/' . $path . '/index.md') ? 'index' : 'item') . '_nextprev'); });