Ecco le parti interessate:
template.php
codice:
<?php
require("Engines/mysql.php");
class page
{
function get_template($tmpNAME)
{
$arr = mysql::get_db_data("argomento"));
return $arr['tmpTEXT'];
}
}
?>
mysql.php
codice:
<?php
class mysql
{
// Default functions
function __construct()
{
// Settings
$this->setvars();
// Enstablishing MySQL Connection
$this->connect();
}
// New Query
function query($type, $array)
{
// Query Type
$tpl = $this->settings['queries']['select'];
// Making replacements
$result = vsprintf($tpl, $array);
return mysql_query($result);
}
// Fetch Array
function fetch_array($result)
{
// Fetch Array
$array = mysql_fetch_array($result, MYSQL_ASSOC);
// codice...
return $array;
}
// Smart Fetching Array
function get_db_data($type, $array)
{
$res = $this->query($type, $array);
return $this->fetch_array($res);
}
}
?>