Commit 0498fed9 authored by Ilya Petrovanov's avatar Ilya Petrovanov
Browse files

feat: test css files

parent 9318343e
1 merge request!3KTemplate Bundle
Showing with 241 additions and 131 deletions
+241 -131
......@@ -3,7 +3,7 @@
1. Склонировать этот репозиторий `git clone https://git.miem.hse.ru/kaa-framework/demo-application/forum`
2. Поднять контейнеры `docker compose up -d`.
Контейнер с kphp будет падать до того, как вы первый раз успешно проведёте компиляцию.
3. Установить зависимости: `docker compose exec php composer install`
3. Установить зависимости: `docker compose exec -w /app php composer install`
## Генерация и компиляция
* `docker compose exec -w /app php php generate.php` - Запускает кодген
......
......@@ -18,7 +18,7 @@
],
"require": {
"kaa/kaa": "0.0.4"
"kaa/kaa": "0.0.5"
},
"require-dev": {
"symplify/easy-coding-standard": "^12.0",
......
This diff is collapsed.
......@@ -4,6 +4,7 @@ use Kaa\Bundle\Database\DatabaseBundle;
use Kaa\Bundle\DependencyInjection\DependencyInjectionBundle;
use Kaa\Bundle\EventDispatcher\EventDispatcherBundle;
use Kaa\Bundle\HttpKernel\HttpKernelBundle;
use Kaa\Bundle\KTemplate\KTemplateBundle;
use Kaa\Bundle\Router\RouterBundle;
use Kaa\Bundle\Security\SecurityBundle;
use Kaa\Bundle\Validator\ValidatorBundle;
......@@ -17,5 +18,6 @@ return [
RouterBundle::class,
ValidatorBundle::class,
SecurityBundle::class,
KTemplateBundle::class,
'instanceGenerator' => InstanceProvider::class,
];
ktemplate:
path: /app/public/css
url: "http://localhost:8800"
template_path: /app/templates
\ No newline at end of file
/* style.css */
p {
color: white;
background-color: black;
}
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
margin: 0;
padding: 0;
}
header {
background-color: #007bff;
color: red;
padding: 10px;
text-align: center;
}
h1 {
margin-bottom: 20px;
}
.container {
width: 80%;
margin: 0 auto;
}
section {
margin: 20px 0;
}
footer {
background-color: #333;
color: yellow;
padding: 10px;
text-align: center;
position: fixed;
bottom: 0;
width: 100%;
}
\ No newline at end of file
......@@ -2,17 +2,26 @@
namespace App\Controller;
use Kaa\Component\DependencyInjectionDecorator\Inject;
use Kaa\Component\HttpMessage\Response\JsonResponse;
use Kaa\Component\HttpMessage\Response\Response;
use Kaa\Component\RequestMapperDecorator\MapQueryParameter;
use Kaa\Component\RequestMapperDecorator\MapRouteParameter;
use Kaa\Component\Router\Attribute\Get;
use KTemplate\ArrayDataProvider;
use KTemplate\Engine;
class ExampleController
{
#[Get('/test')]
public function test(): JsonResponse
{
return new JsonResponse('{"hame": "kolaya"}', 200);
} # warning for incorrect json for parsing?
public function test(
#[Inject]
Engine $ktemplate,
#[MapQueryParameter]
string $name
): Response {
return new Response($ktemplate->render('greeting', new ArrayDataProvider(['name' => $name])));
}
#[Get('/test/{id}')]
public function getTag(
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Download file base64</title>
</head>
<header>
Test
</header>
<body>
<link rel="stylesheet" type="text/css" href="{{ asset("style.css") }}" />
<p>This text will be red as defined in the external stylesheet.</p>
<p>Hello, {{ name }}</p>
<p style="color: blue">The <code>style</code> attribute can override it, though.</p>
</body>
<footer>
Test
</footer>
</html>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment