Project

General

Profile

Paste
Download (3.24 KB) Statistics
| Branch: | Revision:

root / drupal7 / modules / search / search-result.tpl.php @ 27e02aed

1
<?php
2

    
3
/**
4
 * @file
5
 * Default theme implementation for displaying a single search result.
6
 *
7
 * This template renders a single search result and is collected into
8
 * search-results.tpl.php. This and the parent template are
9
 * dependent to one another sharing the markup for definition lists.
10
 *
11
 * Available variables:
12
 * - $url: URL of the result.
13
 * - $title: Title of the result.
14
 * - $snippet: A small preview of the result. Does not apply to user searches.
15
 * - $info: String of all the meta information ready for print. Does not apply
16
 *   to user searches.
17
 * - $info_split: Contains same data as $info, split into a keyed array.
18
 * - $module: The machine-readable name of the module (tab) being searched, such
19
 *   as "node" or "user".
20
 * - $title_prefix (array): An array containing additional output populated by
21
 *   modules, intended to be displayed in front of the main title tag that
22
 *   appears in the template.
23
 * - $title_suffix (array): An array containing additional output populated by
24
 *   modules, intended to be displayed after the main title tag that appears in
25
 *   the template.
26
 *
27
 * Default keys within $info_split:
28
 * - $info_split['module']: The module that implemented the search query.
29
 * - $info_split['user']: Author of the node linked to users profile. Depends
30
 *   on permission.
31
 * - $info_split['date']: Last update of the node. Short formatted.
32
 * - $info_split['comment']: Number of comments output as "% comments", %
33
 *   being the count. Depends on comment.module.
34
 *
35
 * Other variables:
36
 * - $classes_array: Array of HTML class attribute values. It is flattened
37
 *   into a string within the variable $classes.
38
 * - $title_attributes_array: Array of HTML attributes for the title. It is
39
 *   flattened into a string within the variable $title_attributes.
40
 * - $content_attributes_array: Array of HTML attributes for the content. It is
41
 *   flattened into a string within the variable $content_attributes.
42
 *
43
 * Since $info_split is keyed, a direct print of the item is possible.
44
 * This array does not apply to user searches so it is recommended to check
45
 * for its existence before printing. The default keys of 'type', 'user' and
46
 * 'date' always exist for node searches. Modules may provide other data.
47
 * @code
48
 *   <?php if (isset($info_split['comment'])): ?>
49
 *     <span class="info-comment">
50
 *       <?php print $info_split['comment']; ?>
51
 *     </span>
52
 *   <?php endif; ?>
53
 * @endcode
54
 *
55
 * To check for all available data within $info_split, use the code below.
56
 * @code
57
 *   <?php print '<pre>'. check_plain(print_r($info_split, 1)) .'</pre>'; ?>
58
 * @endcode
59
 *
60
 * @see template_preprocess()
61
 * @see template_preprocess_search_result()
62
 * @see template_process()
63
 *
64
 * @ingroup themeable
65
 */
66
?>
67
<li class="<?php print $classes; ?>"<?php print $attributes; ?>>
68
  <?php print render($title_prefix); ?>
69
  <h3 class="title"<?php print $title_attributes; ?>>
70
    <a href="<?php print $url; ?>"><?php print $title; ?></a>
71
  </h3>
72
  <?php print render($title_suffix); ?>
73
  <div class="search-snippet-info">
74
    <?php if ($snippet): ?>
75
      <p class="search-snippet"<?php print $content_attributes; ?>><?php print $snippet; ?></p>
76
    <?php endif; ?>
77
    <?php if ($info): ?>
78
      <p class="search-info"><?php print $info; ?></p>
79
    <?php endif; ?>
80
  </div>
81
</li>