PHP Classes
elePHPant
Icontem

File: examples/example2.php

Recommend this page to a friend!
  Classes of Barton Phillips  >  PHP Site Class  >  examples/example2.php  >  Download  
File: examples/example2.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: 813 bytes
 

Contents

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

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

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

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

$_site = arraytoobjectdeep($_site);

$S = new SiteClass($_site);

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 2</h1>
<p>
$names</p>
<hr>
$footer
EOF;