Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Isnao committed Nov 12, 2020
1 parent e6474a9 commit f3ffe3e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
14 changes: 12 additions & 2 deletions src/Controller/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@
class BlogController extends AbstractController
{
/**
* @Route("/", name="blog")
* @Route("/", name="homepage")
*/
public function index(): Response
{
return $this->render('blog/index.html.twig', [
'controller_name' => 'BlogController',
'message' => 'Page d\'accueil'
]);
}

/**
* @Route("/post/{id}", name="post")
*/
public function post(int $id): Response
{
return $this->render('blog/post.html.twig', [
'id' => $id
]);
}
}
17 changes: 2 additions & 15 deletions templates/blog/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
{% extends 'base.html.twig' %}

{% block title %}Hello BlogController!{% endblock %}
{% block title %}Homepage{% endblock %}

{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>

<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1>

This friendly message is coming from:
<ul>
<li>Your controller at <code><a href="{{ '/var/www/project/src/Controller/BlogController.php'|file_link(0) }}">src/Controller/BlogController.php</a></code></li>
<li>Your template at <code><a href="{{ '/var/www/project/templates/blog/index.html.twig'|file_link(0) }}">templates/blog/index.html.twig</a></code></li>
</ul>
</div>
<h1>{{ message }}</h1>
{% endblock %}
7 changes: 7 additions & 0 deletions templates/blog/post.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends 'base.html.twig' %}

{% block title %}Homepage{% endblock %}

{% block body %}
<h1>L'id de mon post est : {{ id }}</h1>
{% endblock %}

0 comments on commit f3ffe3e

Please sign in to comment.