cache) > 0)
{
trigger_error('You cannot cache templates more than once per initialization', ERR_WARNING);
}
else
{
$templates = $_isso->db->query("SELECT * FROM " . $this->tablename . " WHERE " . $this->namecolumn . " IN ('" . implode("', '", $namearray) . "')" . (($this->extrawhere) ? $this->extrawhere : ''));
while ($template = $_isso->db->fetch_array($templates))
{
$template = $this->_parse($template);
$this->cache[ $template[ $this->namecolumn ] ] = $template[ $this->datacolumn ];
$this->usage["$name"] = 0;
}
}
}
/**
* Loads a template from the cache or the _load function and
* stores the parsed version of it
*
* @param str The name of the template
*
* @return str A parsed and loaded template
*/
function fetch($name)
{
global $_isso;
if (isset($this->cache["$name"]))
{
$template = $this->cache["$name"];
}
else
{
$this->uncached[] = $name;
$_isso->debug("Manually loading template `$name`");
$template = $this->_load($name);
$template = $this->_parse($template);
}
if (!isset($this->usage["$name"]))
{
$this->usage["$name"] = 0;
}
$this->usage["$name"]++;
return $template;
}
/**
* Output a template fully compiled to the browser
*
* @param str Compiled and ready template
*/
function flush($template)
{
global $_isso;
ob_start();
if (empty($template))
{
trigger_error('There was no output to print', ERR_FATAL);
exit;
}
if ($_isso->debug AND isset($_GET['query']))
{
if (is_array($_isso->db->history))
{
echo '
';
}
exit;
}
if ($this->doneflush)
{
trigger_error('A template has already been sent to the output buffer', ERR_FATAL);
exit;
}
if ($_isso->debug)
{
// --- START
$debug = "\n