-
Notifications
You must be signed in to change notification settings - Fork 0
Simple example
Here we have a simple example of how to beauitfy a list In this example we used students compared to eachother in a nice schema.
Please check if you have correct __ToString functions for all the entities used. In this case for example, Student entity needs a __toString function returning it's name, else it will be weird looking at numbers instead of letters
{% extends 'base.html.twig' %}
{% block title %}Teacheren{% endblock %}
{% block body %}
<div class="container my-5">
<h1 class="text-center">Teachers</h1>
<a href="{{ path('teacher_new') }}">Create new</a>
{% for teacheren in teachers %}
<div class="container border rounded my-5">
<div class="row my-3">
<div class="col-1"></div>
<div class="col text-center border rounded py-3">
<strong>Student 1:</strong> </br>
{{ teacheren.student1 }}</div>
<div class="col-4"></div>
<div class="col text-center border rounded py-3">
<strong>Score:</strong> </br>
{{ teacheren.score1 }}</div>
<div class="col-1"></div>
</div>
<div class="row my-3">
<div class="col-1"></div>
<div class="col text-center border rounded py-3">
<strong>Student 2:</strong> </br>
{{ teacheren.student2 }}</div>
<div class="col-4"></div>
<div class="col text-center border rounded py-3">
<strong>Score:</strong> </br>
{{ teacheren.score2 }}</div>
<div class="col-1"></div>
</div>
</div>
<div class="container">
<div class="row my-3">
<div class="col mx-auto text-center border rounded py-3">
<strong>Winnaar:</strong></br>{{ if teacheren.winnaar }}</div>
</div>
</div>
<div class="container text-center">
<a class="btn btn-primary" href="{{ path('teacher_show', {'id': teacheren.id}) }}">Bekijken</a>
// recheck the path name with the correct function name of the controller in src/controller/teacher
<a class="btn btn-primary" href="{{ path('teacher_edit', {'id': teacheren.id}) }}">Bewerken</a>
</div>
{% else %}
<p colspan="4">no records found</p>
{% endfor %}
{% endblock %}
Don't forget to check the path!! You can just t=w-s=s copy and paste this in any (index)twig file Change any name with 'çtrl+f'
If you get an error stating you need a correct "__toString()" function you can do the following: In the src/entity/entity of the error you add the following code:
public function __toString() {
return $this->getId();
}
Don't forget you can change the 'id' with any of the given get functions at the top of the file.
Kerntaak 2 & 3
Symfony
= About code maintained by Symfony and not a third party
-
Home
-
Project Setup
-
Users
-
Unit testing
-
PDF
-
File upload
-
Text editing
-
Miscellaneous
-
Laravel
Work in progress.
ASP.NET MVC
= About code maintained or officially supported by Microsoft
-
Project Setup
-
ASP.NET Core MVC setup
- Model
- Controller
- View
-
- Unit Testing
- Inversion of control
ASP.NET Razor Pages
= About code maintained or officially supported by Microsoft
-
Project Setup
- TBA