CyberX

mobile

Simple pagination PHP script with semantic HTML 5

This is a simple PHP pagination script for your sites writed by CyberX labs. Code below represents how to works pagination:

<?php

/**
 *	Pagination template
 */

$render_node .= '<nav class="revolver__pagination">';
$render_node .= '<ul role="navigation" itemscope itemtype="http://schema.org/SiteNavigationElement">';


/* limit pages per section */
$limit = 5;

for( $i = 1; $i <= $pages_count; $i++) {


	$link = $i === 1 ? '/' : '/?page='. $i; 


	if( $i >= 1 ) {

		$prev = (int)pager['current'] <= 1 ? '/' : '/?page='. ((int)pager['current'] - 1);

		$render_node_prev = (int)pager['current'] <= 1 ? '' : '<li><a itemprop="url" href="'. $prev .'"><span itemprop="name">&laquo;</span></a></li>';

	}

	if( $i <= ((int)$pages_count - 1) ) {

		$next = pager['current'] >= $pages_count ? '/' : '/?page='. ((int)pager['current'] + 1);

		$render_node_next = pager['current'] >= $pages_count ? '' : '<li><a itemprop="url" href="'. $next .'"><span itemprop="name">&raquo;</span></a></li>';


	}



	if( pager['current'] === $i ) {
	
		$render_node_links .= '<li><span><i>'. $i .'</i></span></li>';
	
	} 
	else {

		if( $i <= $pages_count - 1  ) {

			if( $i <= $limit ) {

				$render_node_links .= pager['current'] === 0 && $i === 1 ? '<li><span><i>'. $i .'</i></span></li>' : '<li><a itemprop="url" href="'. $link .'"><span itemprop="name">'. $i .'</span></a></li>';

				
			}

			if( $i == $pages_count - 1 ) {

				$render_node_links .= '<li><span><i>...</i></span></li>';
			
			}
		
		} 
		else if( $i == $pages_count ) {

			$render_node_links .= pager['current'] === 0 && $i === 1 ? '<li><span><i>'. $i .'</i></span></li>' : '<li><a itemprop="url" href="'. $link .'"><span itemprop="name">'. $i .'</span></a></li>';
		
		}

	}

} 


$render_node .= $render_node_prev . $render_node_links . $render_node_next;
$render_node .= '</ul>';
$render_node .= '</nav>';

?>

Few vars you need to modify: $limit - how many pages show in pages section; $pages_count - total pages and pager['current'] - current page.

RevolveR pagination includes semantic microdata HTML 5 for more flexible crawling your website pages. Script works on any PHP version that supports define variables.

RevolveR CMS v.1.4.0 update

Hi, all. Today I release RevolveR CMS version 1.4.0 update. It includes new JOIN queries ABQ support, theming updates such as new pagination and super duper JOIN queries and parametrized selects(xs and j) queries file JSON based DataBase X cache.

RevolveR CMS
RevolveR CMS

In feuture releases I have to add new Forms API and fresh module for creating custom database fields from RevolveR CMS preferences interface thats works with html forms API and GetVars helper to make our CMS more flexible.

This update installing simple: just replace files. Package allowed on GitHub.