Advertisement
Guest User

Untitled

a guest
Apr 10th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.27 KB | None | 0 0
  1. <section class="featured multi-pages white-bg category-listing">
  2.   <div class="container">
  3.     <div class="row">
  4.       <ul class="feat-box-container">
  5.  
  6.         {% if type == "topic" %}
  7.           {% set topicEntries = craft.entries.section('improveYourClub').relatedTo({targetElement: entry}) %}
  8.         {% endif %}
  9.  
  10.         {# use news channel #}
  11.         {% if type == "news" %}
  12.           {% set topicEntries = craft.entries.section('news') %}
  13.         {% endif %}
  14.  
  15.         {# use press release channel #}
  16.         {% if type == "press-release" %}
  17.           {% set topicEntries = craft.entries.section('pressReleases') %}
  18.         {% endif %}        
  19.  
  20.         {% if type == "tag" %}
  21.           {#
  22.           check tag docs https://craftcms.com/support/tag-urls
  23.           and
  24.           https://craftcms.stackexchange.com/questions/17026/use-of-tag-slug-instead-of-tag-title-in-a-custom-rout
  25.         #}
  26.           {# set variable for segment 3 #}
  27.           {% set seg_3 = craft.request.getSegment(3) %}
  28.  
  29.           {# set tag = to segment 3 #}
  30.           {% set tag = craft.tags.slug(seg_3).first() %}
  31.  
  32.           {% set topicEntries = craft.entries.section('improveYourClub').relatedTo(tag) %}
  33.  
  34.         {% endif %}
  35.  
  36.  
  37.  
  38.  
  39.  
  40. {% paginate topicEntries.limit(10)as pageInfo, topicEntries %}
  41.  {# https://craftcms.stackexchange.com/a/11472/193 #}
  42.  {# {% cache globally using key craft.request.path ~ '/p' ~ craft.request.getPageNum for 2 hours %} #}
  43.  
  44.           {% for topic in topicEntries %}
  45.  
  46.             {% if topic.articleImage | length %}
  47.               {# with post image #}
  48.               <li class="col-sm-10 col-sm-offset-1 feat-box">
  49.                 <div class="content">
  50.  
  51.                   {% set postImage = topic.articleImage.first() ?? miscellaneous.articleImage.first() %}
  52.                   {% set croppedImage = {
  53.                     mode: 'crop',
  54.                     width: 460,
  55.                     height: 295,
  56.                     quality: 75
  57.                   } %}
  58.  
  59.                   <div class="col-sm-5">
  60.                     <a href="{{ topic.url }}" class="img-container">
  61.                       <img src="{{ postImage.url(croppedImage) }}" alt="Featured image">
  62.                       {% if topic.membersExclusive == "1" %}
  63.                         <img src="/assets/imgs/member-exclusive.png" alt="Member Exclusive" class="member-exclusive test-3">
  64.                       {% endif %}
  65.                     </a>
  66.                   </div>
  67.                   <div class="col-sm-7">
  68.                     <ul class="topic-breadcrumb">
  69.                       {% if topic.topics | length %}
  70.                         {% for topic in topic.topics %}
  71.                           <li>
  72.                             <a href="{{ topic.url }}">{{ topic.title }}</a>
  73.                           </li>
  74.                         {% endfor %}
  75.                       {% endif %}
  76.                       {% if topic.tags | length %}
  77.                         {% for tag in topic.tags %}
  78.                           <li>
  79.                             <a href="{{ tag.slug }}">{{ tag.title }}</a>
  80.                           </li>
  81.                         {% endfor %}
  82.                       {% endif %}
  83.                     </ul>
  84.                     <p class="header">
  85.                       <a href="{{ topic.url }}">{{ topic.title }}</a>
  86.                     </p>
  87.                     <p>{{ topic.summary }}</p>
  88.                   </div>
  89.                 </div>
  90.               </li>
  91.  
  92.             {% else %}
  93.               {# no post image #}
  94.  
  95.               <li class="col-sm-10 col-sm-offset-1 feat-box no-img">
  96.                 <div class="content">
  97.                   <div class="col-sm-9 col-sm-offset-2">
  98.                   {#
  99.                   <ul class="topic-breadcrumb">
  100.                     <li><a href="#">Member Retention Report</a></li>
  101.                   </ul>
  102.                   #}
  103.                     <p class="header">
  104.                       <a href="{{ topic.url }}">{{ topic.title }}</a>
  105.                     </p>
  106.                     <p>{{ topic.summary }}</p>
  107.                   </div>
  108.                 </div>
  109.               </li>
  110.  
  111.             {% endif %}
  112.           {% endfor %}
  113.  
  114. {# {% endcache %} #}
  115.  
  116.         </ul>
  117.  
  118.           {% include "_includes/pagination" %}
  119.  
  120.       </div>
  121.     </div>
  122.   </section>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement