1 Commits
2.2 ... 3.x

Author SHA1 Message Date
User
035783e264 20231011#1 2023-10-11 00:22:06 +03:00
5 changed files with 43 additions and 3 deletions

View File

@@ -9,5 +9,5 @@ composer create-project rmphp/skeleton
```
```bash
composer create-project rmphp/skeleton:"^2.0"
composer create-project rmphp/skeleton:"^3.0"
```

View File

@@ -12,7 +12,7 @@
"monolog/monolog": "^2.3",
"php-di/php-di": "^6.3",
"symfony/dotenv": "^6.2",
"rmphp/kernel": "^2.0",
"rmphp/kernel": "^3.0",
"rmphp/router": "^1.0",
"rmphp/content": "^2.0",
"rmphp/storage": "^2.0",

View File

@@ -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

View File

@@ -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;

View File

@@ -1,5 +1,5 @@
<article>
<main>
<h1>Hellow</h1>
<h1>Hello. Now is <?=$this->date?></h1>
</main>
</article>