templates/article/list.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% if listWithThumbnails is not defined %}
  3.     {% set listWithThumbnails = false %}
  4. {% endif %}
  5. {% set activeMenu = "infos-pratiques" %}
  6. {% set titreSuffix = "(page " ~ pageNb ~ "/" ~ (articles.getTotalItemCount / pageLimit)|round ~ ")" %}
  7. {% if title is defined and title is not null %}
  8.     {% set titre = title %}
  9. {% else %}
  10.     {% set titre = "Tous les articles " %}
  11. {% endif %}
  12. {% block title %}{{ titre  ~ " " ~ titreSuffix }}{% endblock %}
  13. {% block body %}
  14.     <h1 class="">{{ (titre ~ " <small class=\"text-muted\">" ~ titreSuffix ~ "</small>")|raw }}</h1>
  15.     {% import "common/listWithImages.html.twig" as listWithImages %}
  16.     {% if listWithThumbnails %}
  17.         <div class="row articles-list with-images">
  18.             {% for article in articles %}
  19.                 <div class="col-sm-6 col-md-4 col-lg-3 article with-image 
  20.                     {% if type is defined %}{{ type }}{% endif %}
  21.                 ">
  22.                     <a style="display:block" href="{{ path('showArticleBySlug', {slug:article.slug}) }}">
  23.                         <div class="post-medias">
  24.                             {{ listWithImages.showOneImage(article) }}
  25.                         </div>
  26.                         <p>
  27.                             {# <span class="date">{{ article.createdAt|date("d/m/Y") }}</span>
  28.                             <span class="tags">{{ article.tags|join(', ') }}</span>
  29.                             <br/> #}
  30.                             <span class="title">
  31.                                 {{ article.title }}
  32.                                 {# {{ article.title|raw|striptags|slice(0,30) }}
  33.                                 {% if article.title|raw|striptags|length > 30 %}...{% endif %} #}
  34.                             </span>
  35.                         </p>
  36.                     </a>
  37.                 </div>
  38.             {% endfor %}
  39.         </div>
  40.     {% else %}
  41.         <ul class="list-unstyled">
  42.             {% for article in articles %}
  43.                 <li class="une">
  44.                     <span class="date">{{ article.createdAt|date("d/m/Y") }}<span> <a href="{{ path('showArticleBySlug', {slug:article.slug}) }}">{{ article.title }}</a>
  45.                 </li>
  46.             {% endfor %}
  47.         </ul>
  48.     {% endif %}
  49.     <div class="pagination">
  50.         {{ knp_pagination_render(articles) }}
  51.     </div>
  52. {% endblock %}