app/template/default/Block/Top/news_list.twig line 1

Open in your IDE?
  1. {% set blogs = repository('Plugin\\CMBlogPro\\Entity\\Blog').getList() %}
  2. {% set count = 0 %}
  3. {% if blogs is defined and blogs|length > 0 %}
  4.   {% for blog in blogs %}
  5.     {% if count < maxCount %}
  6.       {# 特定カテゴリを含む ∨ 含まない処理 #}
  7.       {% set isInclude = false %}
  8.       {% set isExclude = true %}
  9.       {% if includeCategories is empty %}
  10.         {% set isInclude = true %}
  11.       {% else %}
  12.         {% for blogCategory in blog.BlogCategories %}
  13.           {% if blogCategory.CategoryId in includeCategories %}
  14.             {% set isInclude = true %}
  15.           {% endif %}
  16.         {% endfor %}
  17.       {% endif %}
  18.       {% if excludeCategories is empty %}
  19.       {% else %}
  20.         {% for blogCategory in blog.BlogCategories %}
  21.           {% if blogCategory.CategoryId in excludeCategories %}
  22.             {% set isExclude = false %}
  23.           {% endif %}
  24.         {% endfor %}
  25.       {% endif %}
  26.       {% if isInclude == true and isExclude == true %}
  27.         {% set count = count + 1 %}
  28.         <div class="home__news-item">
  29.           <a href="{{ url('news_detail/{id}', { 'id': blog.slug ? blog.slug : blog.id }) }}">
  30.             <div class="home__news-date">
  31.               {{ blog.release_date|date('Y年m月d日')|trans }}
  32.             </div>
  33.             <div class="home__news-title">
  34.               {{ blog.title|trans }}
  35.             </div>
  36.             <div class="home__news-detail">
  37.               <span>{{ 'もっと見る'|trans }}</span>
  38.             </div>
  39.           </a>
  40.         </div>
  41.       {% endif %}
  42.     {% endif %}
  43.   {% endfor %}
  44. {% endif %}