PHP code example of brenoroosevelt / cakephp-pagination-cache

1. Go to this page and download the library: Download brenoroosevelt/cakephp-pagination-cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

brenoroosevelt / cakephp-pagination-cache example snippets


Plugin::load('BRPaginationCache');

public function index()
{

		// load component with setup param
		$this->loadComponent('BRPaginationCache.PaginationCache', [
				'session' => 'posts_pagination'
		]);
		
		// restore pagination from session
		$this->PaginationCache->restore();
		
		// pagination		
		$this->set('posts', $this->paginate($this->Posts));
		
		// save pagination from session
		$this->PaginationCache->save();
}