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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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($search_performance); ?>
  37. <?php print render($spellcheck); ?>
  38. <h2><?php print t('Search results');?></h2>
  39. <?php if ($variables['view_mode'] == 'search_api_page_result') : // Uses child template. ?>
  40. <?php print render($search_results); ?>
  41. <?php else : // All other view modes (Teaser, Full content, RSS and so forth). ?>
  42. <div class="search-results">
  43. <?php print render(entity_view($index->item_type, $items, $variables['view_mode'])); ?>
  44. </div>
  45. <?php endif; ?>
  46. <?php print $pager; ?>
  47. <?php else : ?>
  48. <h2><?php print t('Your search yielded no results.');?></h2>
  49. <?php endif; ?>
  50. </div>
  51. <?php endif; ?>