search-api-page-result.tpl.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * @file
  4. * Default theme implementation for displaying a single search result.
  5. *
  6. * This template renders a single search result and is collected into
  7. * search_api_page-results.tpl.php. This and the parent template are
  8. * dependent to one another sharing the markup for definition lists.
  9. *
  10. * View Mode is set in the Search page settings. If you select
  11. * "Themed as search results", then the child template will be used for
  12. * theming the individual result. Any other view mode will bypass the
  13. * child template.
  14. *
  15. * Available variables:
  16. * - $url: URL of the result.
  17. * - $title: Title of the result.
  18. * - $snippet: A small preview of the result. Does not apply to user searches.
  19. * - $info: String of all the meta information ready for print. Does not apply
  20. * to user searches.
  21. * - $info_split: Contains same data as $info, split into a keyed array.
  22. * - $list_classes: CSS classes for this list element.
  23. *
  24. * Default keys within $info_split:
  25. * - $info_split['user']: Author of the node linked to users profile. Depends
  26. * on permission.
  27. * - $info_split['date']: Last update of the node. Short formatted.
  28. *
  29. * Since $info_split is keyed, a direct print of the item is possible.
  30. * This array does not apply to user searches so it is recommended to check
  31. * for its existence before printing. The default keys of 'user' and
  32. * 'date' always exist for node searches.
  33. *
  34. * To check for all available data within $info_split, use the code below.
  35. * @code
  36. * <?php print '<pre>'. check_plain(print_r($info_split, 1)) .'</pre>'; ?>
  37. * @endcode
  38. *
  39. * @see template_preprocess()
  40. * @see template_preprocess_search_result()
  41. * @see template_process()
  42. */
  43. ?>
  44. <li<?php print $list_classes; ?>>
  45. <h3 class="title">
  46. <?php print $url ? l($title, $url['path'], $url['options']) : check_plain($title); ?>
  47. </h3>
  48. <div class="search-snippet-info">
  49. <?php if ($snippet) : ?>
  50. <p class="search-snippet"><?php print $snippet; ?></p>
  51. <?php endif; ?>
  52. <?php if ($info) : ?>
  53. <p class="search-info"><?php print $info; ?></p>
  54. <?php endif; ?>
  55. </div>
  56. </li>