setup basic app controller
This commit is contained in:
parent
af10620337
commit
5a32d90adc
2 changed files with 38 additions and 0 deletions
18
src/Controller/AppController.php
Normal file
18
src/Controller/AppController.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class AppController extends AbstractController
|
||||
{
|
||||
#[Route('/homepage', name: 'homepage')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('app/index.html.twig', [
|
||||
'controller_name' => 'AppController',
|
||||
]);
|
||||
}
|
||||
}
|
20
templates/app/index.html.twig
Normal file
20
templates/app/index.html.twig
Normal file
|
@ -0,0 +1,20 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Hello AppController!{% 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="{{ '/home/thisfro/repos/plant-exchange/src/Controller/AppController.php'|file_link(0) }}">src/Controller/AppController.php</a></code></li>
|
||||
<li>Your template at <code><a href="{{ '/home/thisfro/repos/plant-exchange/templates/app/index.html.twig'|file_link(0) }}">templates/app/index.html.twig</a></code></li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
Reference in a new issue