PHP Classes

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

Recommend this page to a friend!
  Classes of Sergey Beskorovayniy   Silex MVC Blog   app/Views/Controller/blog/posts.html.twig   Download  
File: app/Views/Controller/blog/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: 8 years ago
Size: 1,613 bytes
 

Contents

Class file image Download
{# app/Views/Controller/blog/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 }}{% 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 %} {% else %}{# Get posts for all users #} {% for user, user_posts in posts %} <h2>{{ 'author'|trans|capitalize }}: <a href="/blog/posts/{{ user }}">{{ 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 %}