matt
By: a guest | Jan 24th, 2008 | Syntax:
None | Size: 1.52 KB | Hits: 36 | Expires: Never
CLASS
ARRAY
has all the fiels in the mySQL table, so we can filter the REQUEST information
get($what)
{
switch templete
1 - select * from there where this
2 - select * from there where this and this
query the database
return the $result from the query
}
show($what, $template, $name)
{
switch template
1--------
sub headers($name) etc and any DIVS required
$result = CALL get($what)
$markup = display($result, $template)
$markup .= any other markup required, e.g. more div, subheaderEnd etc.
---------------------
2--------
etc etc
----------------------
end switch
return $markup
}
display($template, $result)
{
global $db;
SWITCH TEMPLATE
$out = '';
while($obj = mysqli_fetch_object($result))
{
$out .= $this->rowDesign($obj);
}
$out .= 'any required markup';
return $out;
}
rowDesign($template, $obj)
{
SWITCH TEMPLATE
the design for a single entry
return $rowMarkup
}
simpleGet($which)
{
returns a basic query - returns a $obj or the result, ready to use.
}
simpleAdd($_REQUEST)
{
add a new entry
}
simpleUpdate($_REQUEST, $IDtoUpdate)
{
updates an entry
}