MAPG-89 adaptations in HtmlContent and index.php

This commit is contained in:
bence committed 2020-06-27 00:44:38 +02:00
1 parent c8a49396c2
commit bf8e5b5f4d
2 files changed
+13 -5

No files matched your search

+11 -4
View File
@@ -1,21 +1,28 @@
<?php namespace MapGuesser\Response;
use MapGuesser\View\Linker;
class HtmlContent extends ContentBase
{
private string $template;
private string $view;
public function __construct(string $template, array &$data = [])
public function __construct(string $view, array &$data = [])
{
$this->template = $template;
$this->view = $view;
$this->data = &$data;
}
public function &render(): string
{
if (!empty($_ENV['DEV'])) {
$generator = new Linker($this->view);
$generator->generate();
}
extract($this->data);
ob_start();
require ROOT . '/views/' . $this->template . '.php';
require ROOT . '/cache/views/' . $this->view . '.php';
$content = ob_get_contents();
ob_end_clean();