SproutCMS

This is the code documentation for the SproutCMS project

source of /skin/default/partials/_hero-banner.php

  1. <?php
  2. use Sprout\Helpers\Enc;
  3. use Sprout\Helpers\File;
  4. use Sprout\Helpers\Lnk;
  5.  
  6.  
  7. if (empty($banners[0]) or empty($banners[0]['filename']) or !File::exists($banners[0]['filename'])) return;
  8. if (empty($banners[0]['link_label'])) $banners[0]['link_label'] = 'Read more';
  9. ?>
  10.  
  11. <div class="section section--hero-banner bg-white">
  12. <img class="hero-banner__img" src="<?= Enc::html(File::resizeUrl($banners[0]['filename'], 'c1600x400-cc~80')); ?>" alt="">
  13.  
  14. <div class="hero-banner__text bg-navyblue">
  15. <div class="container">
  16. <?php if (!empty($banners[0]['heading'])): ?>
  17. <h2 class="hero-banner__heading"><?= Enc::html($banners[0]['heading']); ?></h2>
  18. <?php endif; ?>
  19.  
  20. <?php if (!empty($banners[0]['description'])): ?>
  21. <p><?= Enc::html($banners[0]['description']); ?></p>
  22. <?php endif; ?>
  23.  
  24. <?php if (!empty($banners[0]['link'])): ?>
  25. <p><a class="button button-large" href="<?= Enc::html(Lnk::url($banners[0]['link'])); ?>"><?= Enc::html($banners[0]['link_label']); ?></a></p>
  26. <?php endif; ?>
  27. </div>
  28. </div>
  29. </div>
  30.