templates/front/post/list.html.twig line 1

Open in your IDE?
  1. {% extends 'base_front.html.twig' %}
  2. {% block body %}
  3.     <section id="newsList" class="bg-light-grey">
  4.         <div class="text-center col-md-12">
  5.             <h2 class="red">Nos actualités</h2>
  6.         </div>
  7.         <div class="list-news col-md-11 col-lg-8 col-xl-7 pt-5 m-auto row justify-content-between">
  8.             {% for post in posts %}
  9.                 {% set randomClassLink = random(['bg-orange', 'bg-green', 'bg-red']) %}
  10.                 <div class="col-md-4 col-lg-4 mt-5">
  11.                     <div class="card">
  12.                         <img class="card-img-top" src="{{ asset(constant('App\\Services\\UploadFileService::POST_IMAGE_DIR') ~ post.image) }}" alt="{{ post.title }}" style="height:180px;">
  13.                         <div class="card-body">
  14.                             <span class="date green">{{ post.createdAt|date('d.m.Y') }}</span>
  15.                             <h5 class="card-title red mt-3">{{ post.title }}</h5>
  16.                             <p class="card-text">{{ post.content|slice(0, 250)|striptags|replace({'&eacute;': 'é','&nbsp;': ' ', '&agrave;': 'à', '&egrave;': 'è', '&rsquo;': '’', '&ecirc;': 'ê', '&nbsp;?': ' ?'}) ~ '...' }}</p>
  17.                             <a href="{{ path('front_post_single', {'slug': post.slug}) }}" class="btn-news {{ randomClassLink }}"><img src="{{ asset('img/icons/img-right-white.svg') }}"></a>
  18.                         </div>
  19.                     </div>
  20.                 </div>
  21.             {% endfor %}
  22.         </div>
  23.     </section>
  24. {% endblock %}