templates/front/front_news/index.html.twig line 1

Open in your IDE?
  1. {% extends 'layouts/layouts_front/base_front.html.twig' %}
  2. {% set cmptBack = 0 %}
  3. {% block stylesheets %}
  4. {% endblock %}
  5. {% set titleAff = page.seoTitle|default(page.ptitreonglet)|default(page.ptitre) %}
  6. {% if catEnCours is defined %}
  7.     {% for cat in  categories %}
  8.         {% if cat.id == catEnCours %}
  9.             {% set titleAff = titleAff~" - "~cat.actCatIntitule %}
  10.         {% endif %}
  11.     {% endfor %}
  12. {% endif %}
  13. {% set titleAff = titleAff|slice(0,34)~" | "~nomDuSite %}
  14. {% if app.request.locale == 'fr' %}
  15.     {% set metaDescr = page.seoDescription|default( "Retrouvez toutes les actualités sur le site de "~nomDuSite) %}
  16. {% else %}
  17.     {% set metaDescr = page.seoDescription|default("Find all the news on the "~nomDuSite~" website") %}
  18. {% endif %}
  19. {% if catEnCours is defined %}
  20.     {% for cat in  categories %}
  21.         {% if cat.id == catEnCours %}
  22.             {% if app.request.locale == 'fr' %}
  23.                 {% set metaDescr = "Retrouvez toutes les actualités de la catégorie "~cat.actCatIntitule~" sur le site de "~nomDuSite %}
  24.             {% else %}
  25.                 {% set metaDescr = "Find all the news of the "~cat.actCatIntitule~" category on the "~nomDuSite~" website" %}
  26.             {% endif %}
  27.         {% endif %}
  28.     {% endfor %}
  29. {% endif %}
  30. {% block metaDescription %}{{ metaDescr }}{% endblock %}
  31. {% block metaDescriptionOg %}{{ metaDescr }}{% endblock %}
  32. {% block keywords %}{{ page.seoKeywords }}{% endblock %}
  33. {% block title %}{{ titleAff }}{% endblock %}
  34. {% block titleOg %}{{ titleAff }}{% endblock %}
  35. {% block content %}
  36.     {% if page is not null %}
  37.         {{ include('front/front_news/header.html.twig') }}
  38.         {{ include('front/front_news/nav_ariane.html.twig') }}
  39.     {% endif %}
  40.     <div id="page_module">
  41.         {% set affSousMenuCat = 0 %}
  42.         {% for categ in categories %}
  43.             {% if categ.nbActus > 0 %}
  44.                 {% set affSousMenuCat = affSousMenuCat+1 %}
  45.             {% endif %}
  46.         {% endfor %}
  47.         {% if affSousMenuCat > 1 %}
  48.             <div class="container">
  49.                 <div class="row justify-content-center">
  50.                     <div class="col-md-12 col-lg-11">
  51.                         <div class="d-flex justify-content-center">
  52.                             <a class="btn btn-primary{% if catEnCours is defined and catEnCours == 0 %} active{% endif %}"
  53.                                href="{{ path('front_news') }}">
  54.                                 <span>{% trans %}Toutes les actualit&eacute;s{% endtrans %}</span>
  55.                             </a>
  56.                             {% for categ in categories %}
  57.                                 {% if categ.nbActus > 0 %}
  58.                                     {% set numCouleur = 1 %}
  59.                                     {% set isSelected = 0 %}
  60.                                     {% if categ.id == catEnCours %}
  61.                                         {% set isSelected = 1 %}
  62.                                     {% endif %}
  63.                                     <a class="btn btn-primary{% if isSelected == 1 %} active{% elseif catEnCours != null %} noSelected{% endif %}"
  64.                                        href="{{ path('front_news', {categorie:categ.id}) }}">
  65.                                         <span>{{ categ.actCatIntitule }}</span>
  66.                                     </a>
  67.                                 {% endif %}
  68.                             {% endfor %}
  69.                         </div>
  70.                     </div>
  71.                 </div>
  72.             </div>
  73.         {% endif %}
  74.         {% if actualites|length >0 %}
  75.             <section data-bs-version="5.1" class="slider6 mbr-embla cid-sZogb0MkOH" id="slider6-4n">
  76.                 <div class="position-relative">
  77.                     {#                    <div class="mbr-section-head"> #}
  78.                     {#                        <h4 class="mbr-section-title mbr-fonts-style align-center mb-0 display-2"> #}
  79.                     {#                            <strong>Actualit&eacute;</strong></h4> #}
  80.                     {#                        <h5 class="mbr-section-subtitle mbr-fonts-style align-center mb-0 mt-2 display-5"> #}
  81.                     {#                            Sous titre actualit&eacute; #}
  82.                     {#                        </h5> #}
  83.                     {#                    </div> #}
  84.                     <div class="embla mt-4" data-skip-snaps="true" data-align="center" data-contain-scroll="trimSnaps"
  85.                          data-loop="true" data-auto-play="true" data-auto-play-interval="5" data-draggable="true">
  86.                         <div class="embla__viewport container-fluid">
  87.                             <div class="embla__container">
  88.                                 {% for event in actualites %}
  89.                                     {% set mediaTmp = event.media_fichier %}
  90.                                     {% set mediaDefault = "default.jpg" %}
  91.                                     {% set mediaTmp = webp(webpSupported, mediaTmp) %}
  92.                                     {% set mediaDefault = webp(webpSupported, mediaDefault) %}
  93.                                     <div class="embla__slide slider-image item"
  94.                                          style="margin-left: 1rem; margin-right: 1rem;"
  95.                                          itemscope itemtype="http://schema.org/Event">
  96.                                         <div class="slide-content">
  97.                                             <div class="item-wrapper">
  98.                                                 <div class="item-img">
  99.                                                     <a href="{{ path('front_news_card', {id:event.id}) }}">
  100.                                                         <img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
  101.                                                              alt="{{ event.act_titre|default(nomDuSite) }}"
  102.                                                              title="{{ event.act_titre|default(nomDuSite) }}"
  103.                                                              loading="lazy"
  104.                                                              class="lazyload"
  105.                                                              data-src="{{ asset('/medias_front/actualite/'~mediaTmp|default(mediaDefault)) }}"
  106.                                                              itemprop="image">
  107.                                                     </a>
  108.                                                 </div>
  109.                                             </div>
  110.                                             <div class="item-content">
  111.                                                 <h5 class="item-title mbr-fonts-style display-4">
  112.                                                     {% trans %}Publi&eacute; le{% endtrans %}
  113.                                                     <time itemprop="startDate"
  114.                                                           datetime="{{ event.act_date_publication|date('Y-m-d') }}">
  115.                                                         {{ event.act_date_publication|date("d/m/Y") }}
  116.                                                     </time>
  117.                                                 </h5>
  118.                                                 <h6 class="item-subtitle mbr-fonts-style mt-1 display-7">
  119.                                                     <strong>{{ event.act_titre }}</strong>
  120.                                                 </h6>
  121.                                                 {{ event.act_location|default("Lieu non défini") }}
  122.                                             </div>
  123.                                             <div class="mbr-section-btn item-footer mt-2">
  124.                                                 <a href="{{ path('front_news_card', {id:event.id}) }}"
  125.                                                    class="btn item-btn btn-primary-outline display-7">
  126.                                                     {% trans %}Lire la suite{% endtrans %}
  127.                                                 </a>
  128.                                             </div>
  129.                                         </div>
  130.                                     </div>
  131.                                 {% endfor %}
  132.                             </div>
  133.                         </div>
  134.                         <button class="embla__button embla__button--prev">
  135.                             <span class="mobi-mbri mobi-mbri-arrow-prev mbr-iconfont" aria-hidden="true"></span>
  136.                             <span class="sr-only visually-hidden visually-hidden">Previous</span>
  137.                         </button>
  138.                         <button class="embla__button embla__button--next">
  139.                             <span class="mobi-mbri mobi-mbri-arrow-next mbr-iconfont" aria-hidden="true"></span>
  140.                             <span class="sr-only visually-hidden visually-hidden">Next</span>
  141.                         </button>
  142.                     </div>
  143.                 </div>
  144.             </section>
  145.         {% endif %}
  146.     </div>
  147. {% endblock %}
  148. {% block javascripts %}
  149. {% endblock %}