function render($file, $mime = 'text/html', array $hive = NULL, $ttl = 0)
{
$fw = Base::instance();
$cache = Cache::instance();
if ($cache->exists($hash = $fw->hash($file), $data)) {
return $data;
}
foreach ($fw->split($fw->get('UI') . ';./') as $dir) {
if (is_file($this->view = $fw->fixslashes($dir . $file))) {
if (isset($_COOKIE[session_name()]) && !headers_sent() && session_status() != PHP_SESSION_ACTIVE) {
session_start();
}
$fw->sync('SESSION');
if ($mime && !$fw->get('CLI') && !headers_sent()) {
header('Content-Type: ' . $mime . '; ' . 'charset=' . $fw->get('ENCODING'));
}
$data = $this->sandbox($hive);
if (isset($this->trigger['afterrender'])) {
foreach ($this->trigger['afterrender'] as $func) {
$data = $fw->call($func, $data);
}
}
if ($ttl) {
$cache->set($hash, $data, $ttl);
}
return $data;
}
}
user_error(sprintf(Base::E_Open, $file), E_USER_ERROR);
}