Potus sensim ad ferox abnoba
Sunt torquises imitari velox mirabilis medicinaes. Urna nisl sollicitudin id varius orci quam id turpis. In hac habitasse platea dictumst. Pellentesque vitae velit ex. Ubi est audax amicitia. Morbi tempus commodo mattis.
December 15, 2024 at 11:29:35 AM Tom Doe
Sunt torquises imitari velox mirabilis medicinaes. Urna nisl sollicitudin id varius orci quam id turpis. In hac habitasse platea dictumst. Pellentesque vitae velit ex. Ubi est audax amicitia. Morbi tempus commodo mattis.
December 13, 2024 at 3:23:58 PM Tom Doe
Potus sensim ad ferox abnoba. Morbi tempus commodo mattis. Nunc viverra elit ac laoreet suscipit. Abnobas sunt hilotaes de placidus vita. Vae humani generis. Ut eleifend mauris et risus ultrices egestas. In hac habitasse platea dictumst.
Это демо приложение создано на основе Symfony фреймворка для того, чтобы показать рекомендованный способ разработки Symfony приложений.
Для дополнительной информации обратитесь к Symfony документации.
Нажмите на эту кнопку для просмотра исходного кода Контроллера и шаблона, которые использовались для отображения этой страницы.
src/Controller/BlogController.php at line 52
/**
* 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}', name: 'blog_index_paginated', defaults: ['_format' => 'html'], requirements: ['page' => Requirement::POSITIVE_INT], 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(),
]);
}
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 %}