PHP Classes
elePHPant
Icontem

File: examples/example3.php

Recommend this page to a friend!
  Classes of Barton Phillips  >  PHP Site Class  >  examples/example3.php  >  Download  
File: examples/example3.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Site Class
Create database driven Web sites
Author: By
Last change: Merge branch 'master' of https://github.com/bartonlp/site-class
Merged the testing with master
Date: 8 months ago
Size: 859 bytes
 

Contents

Class file image Download
<?php
// example3.php

require_once("../../../autoload.php");

$_site = array(
 
'siteDomain' => "localhost",
 
'siteName' => "Example3",
 
'copyright' => "2016 Barton L. Phillips",
 
'memberTable' => "members",
 
'noTrack' => true, // do tracking logic in SiteClass
 
'count' => false
);

$dbinfo = array(
 
'database' => 'test.sdb',
 
'engine' => 'sqlite3'
);

ErrorClass::setNoEmailErrs(true);
ErrorClass::setDevelopment(true);

$S = new SiteClass($_site);
$db = new Database((object)$dbinfo);
$S->setDb($db);

// The rest is like the above example.

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

// Do some database operations
$S->query("select fname, lname from $S->memberTable");

$names = '';

while(list(
$fname, $lname) = $S->fetchrow('num')) {
 
$names .= "$fname $lname<br>";
}

echo <<<EOF
$top
<h1>Example 3</h1>
<p>
$names</p>
<hr>
$footer
EOF;