/** * created the relative address to the template folder * @return string url to template folder */ public static function relativeTemplatePath($admin = false) { if ($admin == false) { return "app/templates/" . \HMC\Config::SITE_TEMPLATE() . "/"; } else { return "app/templates/" . \HMC\Config::SITE_TEMPLATE() . "/"; } }
/** * return absolute path to selected template directory * @param string $path path to file from views folder * @param array $data array of data * @param string $custom path to template folder */ public static function renderTemplate($path, $data = false, $custom = false) { self::init(); if (!headers_sent()) { foreach (self::$headers as $header) { header($header, true); } } $file = "app/Templates/" . \HMC\Config::SITE_TEMPLATE() . "/{$path}.php"; if ($custom == false) { if (file_exists($file)) { require $file; } else { Logger::error('File (' . $file . ') was not found.'); Error::showError(500); die; } } else { require "app/Templates/{$custom}/{$path}.php"; } }