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.

How to avoid blocking MAC address on Win 10

Some times we have to stop using WIFI hotspot because routers blocks WIFI MAC hardware address. New Windows 10 insider preview build 19h1 represents core function to randomize WIFI MAC address.

Randomize hardware MAC address on Windows 10 for WIFI connections
Randomize hardware MAC address on Windows 10 for WIFI connections

New feature avalible for Windows 10 19h1 release and can be activated on WIFI settings in Network preferences simple. After activating we have randomized MAC address for WIFI connections at every connect to hot spots.

RevolveR DBX: ABQ JOIN support

Hi, all. Today I was integrate new DBX core into RevolveR CMS for some tests thats represent new JOIN queries syntax support. Today all RevolveR CMS DB core works under ABQ(array based queries).

Now in work cache for JOIN queries but seems all engine works fine.

For example I have to show how to perform INNER JOIN under DBX. First, we have to define DB table fields structure. For emaple I define two tables:

$STRUCT_NODES = [
	'field_id' => [
		'type'   => 'num', // int
		'auto'   => true,  // auto increment
		'length' => 255,
		'value'  => 0
	],
	'field_title' => [
		'type'   => 'text', // varchar
		'length' => 50,
		'fill'   => true
	],
	'field_content' => [
		'type'   => 'text', // varchar
		'length' => 10000,
		'fill'   => true
	],
	'field_description' => [
		'type'   => 'text', // varchar
		'length' => 10000,
		'fill'   => true
	],
	'field_user' => [
		'type'   => 'text',
		'length' => 50,
		'fill'	 => true
	],
	'field_time' => [
		'type'   => 'text',
		'length' => 50,
		'fill'	 => true
	],
	'field_route' => [
		'type'   => 'text',
		'length' => 100,
		'fill'	 => true
	],
	'field_category' => [
		'type'   => 'num',
		'length' => 100,
		'fill'	 => true
	],
	'field_published' => [
		'type'   => 'num',
		'length' => 1,
		'fill'   => false
	]
];

$STRUCT_COMMENTS = [
	'field_id' => [
		'type'   => 'num', // int
		'auto'   => true,  // auto increment
		'length' => 255,
		'value'  => 0
	],
	'field_node_id' => [
		'type'   => 'num',
		'length' => 50,
		'fill'	 => true
	],
	'field_user_id' => [
		'type'   => 'num',
		'length' => 50,
		'fill'	 => true
	],
	'field_user_name' => [
		'type'   => 'text',
		'length' => 100,
		'fill'	 => true
	],
	'field_content' => [
		'type'   => 'text', // varchar
		'length' => 10000,
		'fill'   => true
	],
	'field_time' => [
		'type'   => 'text',
		'length' => 100,
		'fill'	 => true
	],
	'field_published' => [
		'type' 	 => 'num',
		'length' => 1,
		'fill'	 => false
	]
];

Next, we have to configure querie:

	$cFields = ['field_id', 'field_node_id', 'field_user_id', 'field_user_name', 'field_content', 'field_time', 'field_published'];
	$nFields = ['field_id', 'field_title', 'field_content', 'field_description', 'field_user', 'field_time', 'field_route', 'field_category', 'field_published'];

	$nFields['field_id']['criterion_field'] = 'field_id';
	$nFields['field_id']['linked_field'] = 'field_node_id';

	$ncFields = [
		$cFields,
		$nFields
	];

Next, we have to perform query using syntax below:

	unset( $dbx::$result['result'] ); // clean previous result


	$dbx::query('j', ['revolver__nodes', 'revolver__comments'], $ncFields);

DBX automatically configure next SQL syntax:

SELECT `revolver__nodes`.*, `revolver__comments`.* FROM `revolver__nodes` INNER JOIN `revolver__comments` ON(`revolver__nodes`.field_id=`revolver__comments`.field_node_id);

DBX version 1.1.3 avalible on GitHub.