PHP Classes

File: examples/example5.php

Recommend this page to a friend!
  Classes of Barton Phillips   PHP Site Class   examples/example5.php   Download  
File: examples/example5.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Site Class
Create database driven Web sites
Author: By
Last change: Update of examples/example5.php
Date: 3 months ago
Size: 826 bytes


Class file image Download
// example using dbTables

$_site = require_once(getenv("SITELOADNAME"));

$S = new $_site->className($_site);
$T = new dbTables($S);

// Pass some info to getPageTopBottom method
$S->title = "Example"; // Goes in the <title></title>
$S->banner = "<h1>Example</h1>"; // becomes the <header> section
// Add some local css to but a border and padding on the table
$S->css = <<<EOF
main table * {
  padding: .5em;
  border: 1px solid black;

$top, $footer] = $S->getPageTopBottom();

// create a table from the memberTable
$sql = "select id, site, page, ip, lasttime from $S->masterdb.tracker where site='Examples' limit 5";
$tbl = $T->maketable($sql)[0];

echo <<<EOF
<h3>Create a table from the tracker database table</h3>
<p>The tracker table follows:</p>