PHP Classes

File: app/Views/Controller/test/posts.html.twig

Recommend this page to a friend!
  Classes of Sergey Beskorovayniy   Silex MVC Blog   app/Views/Controller/test/posts.html.twig   Download  
File: app/Views/Controller/test/posts.html.twig
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Silex MVC Blog
MVC based blog using on the Silex micro-framework
Author: By
Last change:
Date: 7 years ago
Size: 1,737 bytes
 

Contents

Class file image Download
{# app/Views/Controller/test/posts.html.twig #} {% extends "Layout/base.html.twig" %} {% block title %}{{ action|capitalize }}{% endblock title %} {% block head %} {{ parent() }} {% endblock head %} {% block page_name %}{% if username %}{{ 'author'|trans|capitalize }}: {{ username|capitalize }}{% else %}{{ 'all_posts'|trans|title }}{% endif %}{% endblock page_name %} {% block content %} {% if username %}{# Get posts for this username #} {% for post in posts %} <div class="panel panel-default"> <div class="panel-heading"> <p class="panel-title"><strong>{{ post.title }}</strong></p> <p class="post-date">{{ post.created|date("d.m.Y") }}</p> </div> <div class="panel-body"> {{ post.body }} </div> </div> {% endfor %} {% autoescape false %} {{ paginator }} {% endautoescape %} {% else %}{# Get posts for all users #} {% for user, user_posts in posts %} <h2>{{ 'author'|trans|capitalize }}: <a href="/test/posts/{{ user }}/1">{{ user }}</a></h2> {% for post in user_posts %} <div class="panel panel-default"> <div class="panel-heading"> <p class="panel-title"><strong>{{ post.title }}</strong></p> <p class="post-date">{{ post.created|date("d.m.Y") }}</p> </div> <div class="panel-body"> {{ post.body }} </div> </div> {% endfor %} {% endfor %} {% endif %} {% endblock content %}