cg view
This commit is contained in:
@ -2,19 +2,30 @@
|
||||
|
||||
namespace kernel;
|
||||
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
class Controller
|
||||
{
|
||||
protected \Twig\Loader\FilesystemLoader $loader;
|
||||
protected \Twig\Environment $twig;
|
||||
protected CgView $cgView;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->loader = new \Twig\Loader\FilesystemLoader(ROOT_DIR . $_ENV['VIEWS_PATH']);
|
||||
$this->twig = new \Twig\Environment($this->loader, ['cache' => ROOT_DIR . $_ENV['VIEWS_CACHE_PATH']]);
|
||||
|
||||
$this->cgView = new CgView();
|
||||
$this->cgView->viewPath = ROOT_DIR . "/views";
|
||||
|
||||
$this->init();
|
||||
}
|
||||
|
||||
public function redirect(string $url): void
|
||||
#[NoReturn] protected function redirect(string $url, int $code = 301): void
|
||||
{
|
||||
header("Location: " . $url);
|
||||
header('Location: ' . $url, true, $code);
|
||||
exit;
|
||||
}
|
||||
|
||||
protected function init(){}
|
||||
}
|
Reference in New Issue
Block a user