20231011#1
This commit is contained in:
@@ -7,6 +7,7 @@ use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Laminas\Diactoros\Response\RedirectResponse;
|
||||
use Laminas\Diactoros\Response\TextResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Rmphp\Foundation\Exceptions\AppException;
|
||||
use Rmphp\Kernel\Main;
|
||||
use Throwable;
|
||||
|
||||
@@ -88,6 +89,43 @@ abstract class AbstractController extends Main {
|
||||
return new HtmlResponse($this->template()->getResponse(), $status, array_merge($this->globals()->response()->getHeaders(), $headers));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $point
|
||||
* @param string $string
|
||||
* @return void
|
||||
*/
|
||||
public function setTemplateValue(string $point, string $string) : void {
|
||||
$this->template()->setValue($point, $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $point
|
||||
* @param string $string
|
||||
* @return void
|
||||
*/
|
||||
public function addTemplateValue(string $point, string $string) : void {
|
||||
$this->template()->addValue($point, $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $point
|
||||
* @param string $subTempl
|
||||
* @param array $resource
|
||||
* @return void
|
||||
*/
|
||||
public function setSubtemplate(string $point, string $subTempl, array $resource = []) : void {
|
||||
$this->template()->setSubtemple($point, $subTempl, $resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $point
|
||||
* @param string $subTempl
|
||||
* @param array $resource
|
||||
* @return void
|
||||
*/
|
||||
public function addSubtemplate(string $point, string $subTempl, array $resource = []) : void {
|
||||
$this->template()->addSubtemple($point, $subTempl, $resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $point
|
||||
|
||||
@@ -16,7 +16,9 @@ class IndexController extends AbstractController {
|
||||
$this->addHeader("App-Mode", "Dev");
|
||||
$this->template()->setValue("title", "Главная");
|
||||
$this->template()->setSubtemple("main", "main/index.tpl", [
|
||||
"date" => (new \DateTime())->format('Y-m-d H:i:s')
|
||||
]);
|
||||
return $this->renderResponse();
|
||||
}
|
||||
catch(ServiceException $exception){}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user