Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
035783e264 |
@@ -9,5 +9,5 @@ composer create-project rmphp/skeleton
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer create-project rmphp/skeleton:"^2.0"
|
composer create-project rmphp/skeleton:"^3.0"
|
||||||
```
|
```
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
"monolog/monolog": "^2.3",
|
"monolog/monolog": "^2.3",
|
||||||
"php-di/php-di": "^6.3",
|
"php-di/php-di": "^6.3",
|
||||||
"symfony/dotenv": "^6.2",
|
"symfony/dotenv": "^6.2",
|
||||||
"rmphp/kernel": "^2.0",
|
"rmphp/kernel": "^3.0",
|
||||||
"rmphp/router": "^1.0",
|
"rmphp/router": "^1.0",
|
||||||
"rmphp/content": "^2.0",
|
"rmphp/content": "^2.0",
|
||||||
"rmphp/storage": "^2.0",
|
"rmphp/storage": "^2.0",
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use Laminas\Diactoros\Response\JsonResponse;
|
|||||||
use Laminas\Diactoros\Response\RedirectResponse;
|
use Laminas\Diactoros\Response\RedirectResponse;
|
||||||
use Laminas\Diactoros\Response\TextResponse;
|
use Laminas\Diactoros\Response\TextResponse;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
use Rmphp\Foundation\Exceptions\AppException;
|
||||||
use Rmphp\Kernel\Main;
|
use Rmphp\Kernel\Main;
|
||||||
use Throwable;
|
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));
|
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
|
* @param string $point
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ class IndexController extends AbstractController {
|
|||||||
$this->addHeader("App-Mode", "Dev");
|
$this->addHeader("App-Mode", "Dev");
|
||||||
$this->template()->setValue("title", "Главная");
|
$this->template()->setValue("title", "Главная");
|
||||||
$this->template()->setSubtemple("main", "main/index.tpl", [
|
$this->template()->setSubtemple("main", "main/index.tpl", [
|
||||||
|
"date" => (new \DateTime())->format('Y-m-d H:i:s')
|
||||||
]);
|
]);
|
||||||
|
return $this->renderResponse();
|
||||||
}
|
}
|
||||||
catch(ServiceException $exception){}
|
catch(ServiceException $exception){}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<article>
|
<article>
|
||||||
<main>
|
<main>
|
||||||
<h1>Hellow</h1>
|
<h1>Hello. Now is <?=$this->date?></h1>
|
||||||
</main>
|
</main>
|
||||||
</article>
|
</article>
|
||||||
Reference in New Issue
Block a user