[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_finder/tmpl/search/ -> default_results.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_finder
   6   *
   7   * @copyright   (C) 2011 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\Factory;
  14  use Joomla\CMS\Language\Text;
  15  use Joomla\CMS\Router\Route;
  16  use Joomla\CMS\Uri\Uri;
  17  
  18  ?>
  19  <?php // Display the suggested search if it is different from the current search. ?>
  20  <?php if (($this->suggested && $this->params->get('show_suggested_query', 1)) || ($this->explained && $this->params->get('show_explained_query', 1))) : ?>
  21      <div id="search-query-explained" class="com-finder__explained">
  22          <?php // Display the suggested search query. ?>
  23          <?php if ($this->suggested && $this->params->get('show_suggested_query', 1)) : ?>
  24              <?php // Replace the base query string with the suggested query string. ?>
  25              <?php $uri = Uri::getInstance($this->query->toUri()); ?>
  26              <?php $uri->setVar('q', $this->suggested); ?>
  27              <?php // Compile the suggested query link. ?>
  28              <?php $linkUrl = Route::_($uri->toString(array('path', 'query'))); ?>
  29              <?php $link = '<a href="' . $linkUrl . '">' . $this->escape($this->suggested) . '</a>'; ?>
  30              <?php echo Text::sprintf('COM_FINDER_SEARCH_SIMILAR', $link); ?>
  31          <?php elseif ($this->explained && $this->params->get('show_explained_query', 1)) : ?>
  32              <?php // Display the explained search query. ?>
  33              <p role="alert">
  34                  <?php echo Text::plural('COM_FINDER_QUERY_RESULTS', $this->total, $this->explained); ?>
  35              </p>
  36          <?php endif; ?>
  37      </div>
  38  <?php endif; ?>
  39  <?php // Display the 'no results' message and exit the template. ?>
  40  <?php if (($this->total === 0) || ($this->total === null)) : ?>
  41      <div id="search-result-empty" class="com-finder__empty">
  42          <h2><?php echo Text::_('COM_FINDER_SEARCH_NO_RESULTS_HEADING'); ?></h2>
  43          <?php $multilang = Factory::getApplication()->getLanguageFilter() ? '_MULTILANG' : ''; ?>
  44          <p><?php echo Text::sprintf('COM_FINDER_SEARCH_NO_RESULTS_BODY' . $multilang, $this->escape($this->query->input)); ?></p>
  45      </div>
  46      <?php // Exit this template. ?>
  47      <?php return; ?>
  48  <?php endif; ?>
  49  <?php // Activate the highlighter if enabled. ?>
  50  <?php if (!empty($this->query->highlight) && $this->params->get('highlight_terms', 1)) : ?>
  51      <?php
  52          $this->document->getWebAssetManager()->useScript('highlight');
  53          $this->document->addScriptOptions(
  54              'highlight',
  55              [[
  56                      'class'      => 'js-highlight',
  57                      'highLight'  => $this->query->highlight,
  58              ]]
  59          );
  60      ?>
  61  <?php endif; ?>
  62  <?php // Display a list of results ?>
  63  <ol id="search-result-list" class="js-highlight com-finder__results-list" start="<?php echo (int) $this->pagination->limitstart + 1; ?>">
  64      <?php $this->baseUrl = Uri::getInstance()->toString(array('scheme', 'host', 'port')); ?>
  65      <?php foreach ($this->results as $i => $result) : ?>
  66          <?php $this->result = &$result; ?>
  67          <?php $this->result->counter = $i + 1; ?>
  68          <?php $layout = $this->getLayoutFile($this->result->layout); ?>
  69          <?php echo $this->loadTemplate($layout); ?>
  70      <?php endforeach; ?>
  71  </ol>
  72  <?php // Display the pagination ?>
  73  <div class="com-finder__navigation search-pagination">
  74      <?php if ($this->params->get('show_pagination', 1) > 0) : ?>
  75      <div class="com-finder__pagination w-100">
  76          <?php echo $this->pagination->getPagesLinks(); ?>
  77      </div>
  78      <?php endif; ?>
  79      <?php if ($this->params->get('show_pagination_results', 1) > 0) : ?>
  80          <div class="com-finder__counter search-pages-counter">
  81              <?php // Prepare the pagination string.  Results X - Y of Z ?>
  82              <?php $start = (int) $this->pagination->limitstart + 1; ?>
  83              <?php $total = (int) $this->pagination->total; ?>
  84              <?php $limit = (int) $this->pagination->limit * $this->pagination->pagesCurrent; ?>
  85              <?php $limit = (int) ($limit > $total ? $total : $limit); ?>
  86              <?php echo Text::sprintf('COM_FINDER_SEARCH_RESULTS_OF', $start, $limit, $total); ?>
  87          </div>
  88      <?php endif; ?>
  89  </div>


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