Ubi est audax amicitia
Teres talis saepe tractare de camerarius flavum sensorem. Bassus fatalis classiss virtualiter transferre de flavum. Aliquam sodales odio id eleifend tristique. Ubi est audax amicitia. Ut suscipit posuere justo at vulputate.
Choose your language
January 27, 2023 at 8:23:04 AM Jane Doe
Teres talis saepe tractare de camerarius flavum sensorem. Bassus fatalis classiss virtualiter transferre de flavum. Aliquam sodales odio id eleifend tristique. Ubi est audax amicitia. Ut suscipit posuere justo at vulputate.
January 24, 2023 at 9:43:13 AM Tom Doe
Vae humani generis. Ubi est barbatus nix. Mauris dapibus risus quis suscipit vulputate. Ut suscipit posuere justo at vulputate. Teres talis saepe tractare de camerarius flavum sensorem. Eros diam egestas libero eu vulputate risus.
January 20, 2023 at 8:19:45 AM Tom Doe
Aliquam sodales odio id eleifend tristique. Era brevis ratione est. Curabitur aliquam euismod dolor non ornare. Pellentesque et sapien pulvinar consectetur. Ubi est audax amicitia. Eros diam egestas libero eu vulputate risus. Vae humani generis.
This is a demo application built in the Symfony Framework to illustrate the recommended way of developing Symfony applications.
For more information, check out the Symfony doc.
Click on this button to show the source code of the Controller and template used to render this page.
src/Controller/BlogController.php at line 51
/**
* NOTE: For standard formats, Symfony will also automatically choose the best
* Content-Type header for the response.
*
* See https://symfony.com/doc/current/routing.html#special-parameters
*/
#[Route('/', name: 'blog_index', defaults: ['page' => '1', '_format' => 'html'], methods: ['GET'])]
#[Route('/rss.xml', name: 'blog_rss', defaults: ['page' => '1', '_format' => 'xml'], methods: ['GET'])]
#[Route('/page/{page<[1-9]\d{0,8}>}', name: 'blog_index_paginated', defaults: ['_format' => 'html'], methods: ['GET'])]
#[Cache(smaxage: 10)]
public function index(Request $request, int $page, string $_format, PostRepository $posts, TagRepository $tags): Response
{
$tag = null;
if ($request->query->has('tag')) {
$tag = $tags->findOneBy(['name' => $request->query->get('tag')]);
}
$latestPosts = $posts->findLatest($page, $tag);
// Every template name also has two extensions that specify the format and
// engine for that template.
// See https://symfony.com/doc/current/templates.html#template-naming
return $this->render('blog/index.'.$_format.'.twig', [
'paginator' => $latestPosts,
'tagName' => $tag?->getName(),
]);
}
/home/charly/Téléchargements/demo-2.4.0/templates/blog/index.html.twig at line 1
{% extends 'base.html.twig' %}
{% block body_id 'blog_index' %}
{% block main %}
{% for post in paginator.results %}
{{ include('blog/_post.html.twig') }}
{% else %}
<div class="jumbotron">{{ 'post.no_posts_found'|trans }}</div>
{% endfor %}
{% if paginator.hasToPaginate %}
<div class="navigation text-center">
<ul class="pagination pagination-lg">
{% if paginator.hasPreviousPage %}
<li class="page-item">
<a class="page-link" href="{{ path('blog_index_paginated', {page: paginator.previousPage, tag: tagName}) }}" rel="previous">
<i class="fa fw fa-long-arrow-left"></i> {{ 'paginator.previous'|trans }}
</a>
</li>
{% else %}
<li class="page-item disabled">
<span class="page-link"><i class="fa fw fa-arrow-left"></i> {{ 'paginator.previous'|trans }}</span>
</li>
{% endif %}
{% for i in 1..paginator.lastPage %}
{% if i == paginator.currentPage %}
<li class="page-item active">
<span class="page-link">{{ i }} <span class="sr-only">{{ 'paginator.current'|trans }}</span></span>
</li>
{% else %}
<li class="page-item"><a class="page-link" href="{{ path('blog_index_paginated', {page: i, tag: tagName}) }}">{{ i }}</a></li>
{% endif %}
{% endfor %}
{% if paginator.hasNextPage %}
<li class="page-item">
<a class="page-link" href="{{ path('blog_index_paginated', {page: paginator.nextPage, tag: tagName}) }}">
<span>{{ 'paginator.next'|trans }} <i class="fa fw fa-long-arrow-right"></i></span>
</a>
</li>
{% else %}
<li class="page-item disabled">
<span class="page-link">{{ 'paginator.next'|trans }} <i class="fa fw fa-long-arrow-right"></i></span>
</li>
{% endif %}
</ul>
</div>
{% endif %}
{% endblock %}
{% block sidebar %}
{{ parent() }}
{{ show_source_code(_self) }}
{{ include('blog/_rss.html.twig') }}
{% endblock %}