PClib demo site

<?php
/* project: Basic grid, file: basicgrid.php */

//Include pclib framework
require 'pclib/pclib.php';

//Create pclib application
$app = new PCApp('demo');

$datasource 'pdo_mysql://user:password@localhost/test';

//Connect to database and register it as $app->db
$app->db = new PCDb($datasource);

//Add jquery + bootstrap
$app->layout->addScripts('js/jquery.js''css/bootstrap.min.css');

$grid = new PCGrid("tpl/mobilegrid.tpl");
$grid->setQuery("select * from PRODUCTS where ID < 50");
$grid->_TITLE 'Mobile grid';

//AJAX request
if ($_GET['action'] == 'nextpage')
{
  if (
$_GET['page'] <= $grid->pager->getValue('maxpage')) {
    
$grid->setPage($_GET['page']);
    print 
$grid->html('results');
  }
  die();
}

print 
$grid;

?>

Elapsed time: 23.71 ms