<?php
require_once __DIR__ . '/config.php';
require_once __DIR__ . '/inc/db.inc.php';
require_once __DIR__ . '/inc/tpl.class.php';
require_once __DIR__ . '/inc/router.inc.php';

$tpl = (object)$tpl;

$generated = round(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], 5);

if(!@$tpl->debug) {
  tpl::view($tpl->file,
    array_merge([
      'page' => $_page,
      'generated' => $generated,
      'basepath' => $config->env->basepath
    ],
    gettype($tpl->data) !== 'string' ? $tpl->data : [])
  );
}
else {
  echo "<pre>";
  print_r($_content);
  echo "</pre>";
}