<?php
//Include pclib framework
require 'pclib/pclib.php';
session_start();
//Create pclib application
$app = new PCApp('demo');
$datasource = 'pdo_mysql://root@localhost/test';
$app->db = new PCDb($datasource);
//Load website template
$app->setLayout('tpl/website.tpl');
//Include font-awesome icons (we are using glyph "fa-bus" in the button)
$app->layout->addScripts('css/font-awesome.min.css');
$form = new PCForm('tpl/orderform.tpl');
if ($form->submitted) {
if ($form->validate()) {
$app->message('Your order has been submitted.');
$app->redirect(['url' => '?r=orderform']);
}
}
print $form;
/*
In file controllers/OrdersController.php:
class OrdersController extends pclib\Controller {
function cartinfoAction()
{
return "In your shopping cart: 4 products";
}
//@datasource orders/shipping
function shipping()
{
return ['CS-POST', 'PPL', 'DPD Pickup'];
}
}
*/
?>
Elapsed time: 21 ms