/** * @param string $tpl * @param array $variables * @throws Exception */ public function view($tpl, array $variables = []) { if (!$this->view) { foreach ($variables as $key => $variable) { Page::assignOnMap($tpl, $key, $variable); } Page::loadTemplate($tpl); $this->view = true; } else { throw new Exception("View has already been displayed!"); } }