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.
27 януари 2023 г. в 15:23:04 ч. 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.
24 януари 2023 г. в 16:43:13 ч. 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.
20 януари 2023 г. в 15:19:45 ч. 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.
Това е примерно приложение създатено със Symfony Framework за да илюстрира препоръчителния начин за разработка със Symfony.
За повече информация, посетете Symfony документацията.
Кликнете върху този бутон, за да покажете изходния код на Контролера и темплейта използвани за показването на тази страница.
/**
* 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
*/
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 ? $tag->getName() : null,
]);
}
{% extends 'base.html.twig' %}
{% block body_id 'blog_index' %}
{% block main %}
{% for post in paginator.results %}
<article class="post">
<h2>
<a href="{{ path('blog_post', {slug: post.slug}) }}">
{{ post.title }}
</a>
</h2>
<p class="post-metadata">
<span class="metadata"><i class="fa fa-calendar"></i> {{ post.publishedAt|format_datetime('long', 'medium', '', 'UTC') }}</span>
<span class="metadata"><i class="fa fa-user"></i> {{ post.author.fullName }}</span>
</p>
<p>{{ post.summary }}</p>
{{ include('blog/_post_tags.html.twig') }}
</article>
{% else %}
<div class="well">{{ 'post.no_posts_found'|trans }}</div>
{% endfor %}
{% if paginator.hasToPaginate %}
<div class="navigation text-center">
<ul class="pagination">
{% if paginator.hasPreviousPage %}
<li class="prev"><a 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="prev disabled"><span><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="active"><span>{{ i }} <span class="sr-only">{{ 'paginator.current'|trans }}</span></span></li>
{% else %}
<li><a href="{{ path('blog_index_paginated', {page: i, tag: tagName}) }}">{{ i }}</a></li>
{% endif %}
{% endfor %}
{% if paginator.hasNextPage %}
<li class="next"><a href="{{ path('blog_index_paginated', {page: paginator.nextPage, tag: tagName}) }}" rel="next">{{ 'paginator.next'|trans }} <i class="fa fw fa-arrow-right"></i></a></li>
{% else %}
<li class="next disabled"><span>{{ 'paginator.next'|trans }} <i class="fa fw fa-arrow-right"></i></span></li>
{% endif %}
</ul>
</div>
{% endif %}
{% endblock %}
{% block sidebar %}
{{ parent() }}
{{ show_source_code(_self) }}
{{ include('blog/_rss.html.twig') }}
{% endblock %}