Symfony Demo
  • Homepage
  • Search
  • Choose language
    • العربية ar
    • Български bg
    • Bosanski bs
    • Català ca
    • Čeština cs
    • Deutsch de
    • English en
    • Español es
    • Français fr
    • Hrvatski hr
    • Indonesia id
    • Italiano it
    • 日本語 ja
    • Lietuvių lt
    • Nederlands nl
    • Polski pl
    • Português (brasil) pt
    • Română ro
    • Русский ru
    • Slovenščina sl
    • Српски (ћирилица) sr
    • Srpski (latinica) sr
    • Türkçe tr
    • Українська uk
    • 中文(中国) zh

Bassus fatalis classiss virtualiter transferre de flavum

November 6, 2017 at 5:36:43 PM Tom Doe

Sed varius a risus eget aliquam. Silva de secundus galatae demitto quadra. Pellentesque vitae velit ex. Mauris dapibus risus quis suscipit vulputate. Pellentesque et sapien pulvinar consectetur. Eros diam egestas libero eu vulputate risus.

ipsum labore lorem

  • Previous
  • 1
  • 2 (current)
  • Next

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.

Source code used to render this page

Controller codesrc/Controller/BlogController.php at line 50

/**
 * @Route("/", defaults={"page": "1", "_format"="html"}, methods="GET", name="blog_index")
 * @Route("/rss.xml", defaults={"page": "1", "_format"="xml"}, methods="GET", name="blog_rss")
 * @Route("/page/{page<[1-9]\d*>}", defaults={"_format"="html"}, methods="GET", name="blog_index_paginated")
 * @Cache(smaxage="10")
 *
 * 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,
    ]);
}

Twig template codetemplates/blog/index.html.twig at line 1

Blog Posts RSS

© 2025 - The Symfony Project

MIT License