SproutCMS

This is the code documentation for the SproutCMS project

source of /skin/default/partials/_promos-three.php

  1. <?php
  2. use Sprout\Helpers\Enc;
  3. use Sprout\Helpers\File;
  4. use Sprout\Helpers\Lnk;
  5. use Sprout\Helpers\Text;
  6.  
  7. if (empty($promos)) {
  8. return;
  9. }
  10. ?>
  11.  
  12.  
  13. <div class="section bg-lightgrey">
  14. <div class="container">
  15.  
  16. <h2>Three promo boxes</h2>
  17.  
  18. <div class="promo-list row">
  19.  
  20. <?php foreach ($promos as $promo): ?>
  21. <?php
  22. if (empty($promo['link_label'])) {
  23. $promo['link_label'] = 'Read more';
  24. }
  25. ?>
  26.  
  27. <div class="promo col-xs-12 col-sm-4">
  28. <div class="promo__inner bg-white">
  29. <?php if (!empty($promo['filename']) and File::exists($promo['filename'])): ?>
  30. <div class="promo__img"><img src="<?= Enc::html(File::resizeUrl($promo['filename'], 'c600x400')); ?>" alt=""></div>
  31. <?php endif; ?>
  32.  
  33. <div class="promo__content">
  34. <?php if (!empty($promo['heading'])): ?>
  35. <h3 class="promo__content__heading"><?= Enc::html($promo['heading']); ?></h3>
  36. <?php endif; ?>
  37.  
  38. <?php
  39. echo Text::richtext(Text::limitWords($promo['description'], 20));
  40. ?>
  41.  
  42. <?php if (!empty($promo['link'])): ?>
  43. <a href="<?= Enc::html(Lnk::url($promo['link'])); ?>" class="button promo__button"><?= Enc::html($promo['link_label']); ?></a>
  44. <?php endif; ?>
  45. </div>
  46. </div>
  47. </div>
  48.  
  49. <?php endforeach; ?>
  50.  
  51. </div>
  52.  
  53. </div>
  54. </div>
  55.