Re: Blog Pagination (Next/Previous) for Morfy CMS
@tovic
1) Tags Page
2) Page Views Counter
3) Next/Previous Navigation
I installed but spend error
( ! ) Parse error: syntax error, unexpected ''tags_config'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in C:\wamp\www\demo\config.php on line 22
Call Stack
# Time Memory Function Location
1 0.0010 250960 {main}( ) ..\index.php:0
2 0.0040 403608 Morfy->run( ) ..\index.php:47
3 0.0040 403648 Morfy->loadConfig( ) ..\Morfy.php:138config.php
'http://localhost/demo',
'site_charset' => 'UTF-8',
'site_timezone' => 'Kwajalein',
'site_theme' => 'default',
'site_title' => 'demo',
'site_description' => 'demo',
'site_keywords' => 'demo',
'email' => 'demo@gmail.com',
'plugins' => array(
'markdown',
'sitemap',
'pageview',
'tags',
'nextprev'
),
'pageview_config' => array(
// Change to `false` if you want to remove the leading zero in counter
'leading_zero' => '000000'
)
'tags_config' => array( // <= Configuration
'param' => 'tagged', // <= Page parameter name in URL for the tags filter
'param_page' => 'page', // <= Page parameter name in URL for the page filter
'limit' => 5, // <= Number of posts to display per page request
'separator' => ', ', // <= Separator for each tag link
'classes' => array( // <= List of item's HTML classes
'page_item' => 'page',
'nav' => 'pager',
'nav_prev' => 'previous',
'nav_next' => 'next',
'nav_disabled' => 'disabled',
'tag' => 'tag',
'current' => 'current'
),
'labels' => array( // <= List of item's readable text or labels
'page_header' => 'Showing posts tagged in {tag}.
',
'nav_prev' => '← Previous',
'nav_next' => 'Next →',
'not_found' => 'No more posts found tagged in {tag}.
'
)
)
'nextprev_config' => array( // <= Configuration
'param' => 'page', // <= Page parameter name in URL
'limit' => 5, // <= Number of posts to display per page request
'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' => 'Not found.
'
)
)
);
tempate news.html
runAction('theme_content_before'); ?>
getUriSegments();
$path = implode('/', $path);
// Number of posts to display per page request
$per_page = isset($config['limit']) ? $config['limit'] : 5;
// Get all posts
$all_posts = Morfy::factory()->getPages(CONTENT_PATH . '/' . $path . '/', 'date', 'DESC', array('404', 'index'));
// Calculate total pages
$total_pages = ceil(count($all_posts) / $per_page);
// Get current page offset
$current_page = isset($_GET[$config['param']]) ? $_GET[$config['param']] : 1;
// Split all posts into chunks
$posts = is_array($all_posts) ? array_chunk($all_posts, $per_page) : array();
$tag_filter = Morfy::$config['tags_config']['param'];
if(isset($tag_filter) && isset($_GET[$tag_filter])) { // Tags page
Morfy::factory()->runAction('tags');
} else { // Normal posts loop
Morfy::factory()->runAction('index_nextprev');
}
// Posts loop
if(isset($posts[$current_page - 1]) && ! empty($posts[$current_page - 1])) {
foreach($posts[$current_page - 1] as $post) {
// use default image if not write Thumbnail
$thumbnail = ($post['thumbnail']) ? $post['thumbnail'] : $config['Site_url'].'public/images/default.jpg';
echo '';
}
} else {
echo '' . $config['labels']['not_found'] . '';
}
?>
';
$html .= $current_page > 1 ? '' . $config['labels']['nav_prev'] . ' ' : '' . $config['labels']['nav_prev'] . ' ';
$html .= $current_page < $total_pages ? ' ' . $config['labels']['nav_next'] . ' ' : ' ' . $config['labels']['nav_next'] . ' ';
$html .= '';
echo $html;
?>
runAction('theme_content_after'); ?>
news_post.html
runAction('theme_content_before'); ?>![]()
Posted on
Total Page Views: runAction('pageview'); ?> runAction('item_nextprev'); ?> runAction('theme_content_after'); ?>
I did not touch any file!
and I get this error ![]()
