smarty = new Smarty(); $this->smarty->setTemplateDir(BASE_PATH . '/storage/view/'); $this->smarty->setCompileDir(BASE_PATH . '/runtime/smarty/compile/'); $this->smarty->setCacheDir(BASE_PATH . '/runtime/smarty/cache/'); } public function render(string $template, array $data): string { foreach ($data as $key => $value) { $this->smarty->assign($key, $value); } return $this->smarty->fetch($template); } }