2019-11-18 13:33:45 +00:00
|
|
|
<?php
|
|
|
|
namespace Application\Services;
|
|
|
|
|
|
|
|
class View {
|
|
|
|
public function render($path, $args = []) {
|
|
|
|
ob_start();
|
|
|
|
extract($args);
|
|
|
|
$auth = ServiceContainer::Authentication();
|
2019-11-19 03:36:39 +00:00
|
|
|
$session = ServiceContainer::Session();
|
|
|
|
$view = $this;
|
|
|
|
$root = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['SERVER_NAME'];
|
2019-11-18 13:33:45 +00:00
|
|
|
include('Application/Views/'.$path.'.php');
|
|
|
|
$rendered_string = ob_get_contents();
|
|
|
|
ob_end_clean();
|
|
|
|
return $rendered_string;
|
|
|
|
}
|
2019-11-19 03:36:39 +00:00
|
|
|
public function include($path, $args = []) {
|
|
|
|
echo $this->render($path, $args);
|
|
|
|
}
|
2019-11-18 13:33:45 +00:00
|
|
|
}
|