search-api-page-results.tpl.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * @file
  4. * Default theme implementation for displaying search results.
  5. *
  6. * This template collects each invocation of theme_search_result(). This and
  7. * the child template are dependent to one another sharing the markup for
  8. * definition lists.
  9. *
  10. * Note that modules and themes may implement their own search type and theme
  11. * function completely bypassing this template.
  12. *
  13. * Available variables:
  14. * - $result_count: Number of results.
  15. * - $spellcheck: Possible spelling suggestions from Search spellcheck module.
  16. * - $search_results: All results rendered as list items in a single HTML string.
  17. * - $items: All results as it is rendered through search-result.tpl.php.
  18. * - $search_performance: The number of results and how long the query took.
  19. * - $sec: The number of seconds it took to run the query.
  20. * - $pager: Row of control buttons for navigating between pages of results.
  21. * - $index:
  22. * - $keys: The keywords of the executed search.
  23. * - $page_machine_name: Machine name of the current Search API Page.
  24. *
  25. * View Mode is set in the Search page settings. If you select
  26. * "Themed as search results", then the child template will be used for
  27. * theming the individual result. Any other view mode will bypass the
  28. * child template.
  29. *
  30. * @see template_preprocess_search_api_page_results()
  31. */
  32. ?>
  33. <?php if (!empty($result_count)) : ?>
  34. <div class="search-api-page <?php print 'search-api-page-' . $page_machine_name . ' view-mode-' . $variables['view_mode'];?>">
  35. <?php if ($result_count) : ?>
  36. <?php print render($spellcheck); ?>
  37. <?php if ($variables['view_mode'] == 'search_api_page_result') : // Uses child template. ?>
  38. <?php print render($search_results); ?>
  39. <?php else : // All other view modes (Teaser, Full content, RSS and so forth). ?>
  40. <div class="search-results">
  41. <?php print render(entity_view($index->item_type, $items, $variables['view_mode'])); ?>
  42. </div>
  43. <?php endif; ?>
  44. <?php print $pager; ?>
  45. <?php else : ?>
  46. <h2><?php print t('Your search yielded no results.');?></h2>
  47. <?php endif; ?>
  48. </div>
  49. <?php endif; ?>