Этот коммит содержится в:
2019-11-05 01:14:53 +03:00
Коммит 499374305a
29 изменённых файлов: 1004 добавлений и 0 удалений

44
src/core/View.php Обычный файл
Просмотреть файл

@@ -0,0 +1,44 @@
<?php
namespace MyApp\Core;
class View
{
/**
* @var string
*/
public $title = '';
public function json($data)
{
}
public function render($template)
{
/* @var \App $app */
global $app;
$fileName = $app->config->getSrcDir().'/templates/'.$template.'.tpl.php';
if (file_exists($fileName)) {
ob_start();
require $fileName;
ob_end_flush();
}
}
/**
* @param string $title
*
* @return View
*/
public function setTitle(string $title)
{
/* @var \App $app */
global $app;
$this->title = $title.' &mdash; '.$app->config->getSiteName();
return $this;
}
}