[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/modules/mod_tags_popular/tmpl/ -> cloud.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  mod_tags_popular
   6   *
   7   * @copyright   (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\Language\Text;
  14  use Joomla\CMS\Router\Route;
  15  use Joomla\Component\Tags\Site\Helper\RouteHelper;
  16  
  17  $minsize = $params->get('minsize', 1);
  18  $maxsize = $params->get('maxsize', 2);
  19  
  20  ?>
  21  <div class="mod-tagspopular-cloud tagspopular tagscloud">
  22  <?php
  23  if (!count($list)) : ?>
  24      <div class="alert alert-info">
  25          <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
  26          <?php echo Text::_('MOD_TAGS_POPULAR_NO_ITEMS_FOUND'); ?>
  27      </div>
  28  <?php else :
  29      // Find maximum and minimum count
  30      $mincount = null;
  31      $maxcount = null;
  32      foreach ($list as $item) {
  33          if ($mincount === null || $mincount > $item->count) {
  34              $mincount = $item->count;
  35          }
  36          if ($maxcount === null || $maxcount < $item->count) {
  37              $maxcount = $item->count;
  38          }
  39      }
  40      $countdiff = $maxcount - $mincount;
  41  
  42      foreach ($list as $item) :
  43          if ($countdiff === 0) :
  44              $fontsize = $minsize;
  45          else :
  46              $fontsize = $minsize + (($maxsize - $minsize) / $countdiff) * ($item->count - $mincount);
  47          endif;
  48          ?>
  49          <span class="tag">
  50              <a class="tag-name" style="font-size: <?php echo $fontsize . 'em'; ?>" href="<?php echo Route::_(RouteHelper::getComponentTagRoute($item->tag_id . ':' . $item->alias, $item->language)); ?>">
  51                  <?php echo htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?></a>
  52              <?php if ($display_count) : ?>
  53                  <span class="tag-count badge bg-info"><?php echo $item->count; ?></span>
  54              <?php endif; ?>
  55          </span>
  56      <?php endforeach; ?>
  57  <?php endif; ?>
  58  </div>


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer