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

Open in your IDE?
  1. {# recup uniquement les photos #}
  2. {% set arr = [] %}
  3. {% for img in allImgs %}
  4.   {% set lengthA = img.imgUrlFile|length %}
  5.   {% set ext = img.imgUrlFile|slice((lengthA - 3), 3) %}
  6.   {% if ext == 'mp4' or ext == 'm4v' %}
  7.   {% else %}
  8.     {% if img.actif == 1 %}
  9.       {% set arr = arr|merge({(img.ordre): img}) %}
  10.     {% endif %}
  11.   {% endif %}
  12. {% endfor %}
  13. {% if arr|length > 2 %}
  14.   {% set img1 = arr[0] %}
  15.   {% set img2 = arr[1] %}
  16.   {% set img3 = arr[2] %}
  17. {% endif %}
  18. <div class="container">
  19.   <div id="carouselExampleCaptions" class="carousel slide" data-bs-ride="carousel">
  20.     <div class="carousel-inner">
  21.       {% set max = (arr|length) - 1 %}
  22.       {% set tour = 0 %}
  23.         {% for vign in arr %}
  24.             <div  class="carousel-item{% if tour == 0 %} active{% endif %} bg"
  25.                   style="background-image:url({{ pathLocal }}uploads/mobilier/640/v_{{ vign.imgUrlFile }})"
  26.             >
  27.             </div>
  28.           {% set tour = tour + 1 %}
  29.         {% endfor %}
  30.     </div>
  31.     <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="prev">
  32.       <span class="carousel-control-prev-icon" aria-hidden="true"></span>
  33.       <span class="visually-hidden">Previous</span>
  34.     </button>
  35.     <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="next">
  36.       <span class="carousel-control-next-icon" aria-hidden="true"></span>
  37.       <span class="visually-hidden">Next</span>
  38.     </button>
  39.     <div class="carousel-indicators">
  40.       {% set tourA = 0 %}
  41.       {% for vign in arr %}
  42.         <button type="button"
  43.           data-bs-target="#carouselExampleCaptions"
  44.           data-bs-slide-to="{{ tourA }}"
  45.           {% if tourA == 0 %}class="active" aria-current="true"{% endif %}
  46.           aria-label="Slide {{ ( tourA + 1 ) }}">
  47.           <img src="{{ pathLocal }}uploads/mobilier/640/v_{{ vign.imgUrlFile }}" alt="up-paris" class="d-block w-100 img-fluid">
  48.         </button>
  49.         {% set tourA = tourA + 1 %}
  50.       {% endfor %}
  51.     </div>
  52.   </div>
  53. </div>