| 1 |
<?php
|
| 2 |
// $Id: search-result.tpl.php,v 1.3 2008/10/13 12:31:42 dries Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Default theme implementation for displaying a single search result.
|
| 7 |
*
|
| 8 |
* This template renders a single search result and is collected into
|
| 9 |
* search-results.tpl.php. This and the parent template are
|
| 10 |
* dependent to one another sharing the markup for definition lists.
|
| 11 |
*
|
| 12 |
* Available variables:
|
| 13 |
* - $url: URL of the result.
|
| 14 |
* - $title: Title of the result.
|
| 15 |
* - $snippet: A small preview of the result. Does not apply to user searches.
|
| 16 |
* - $info: String of all the meta information ready for print. Does not apply
|
| 17 |
* to user searches.
|
| 18 |
* - $info_split: Contains same data as $info, split into a keyed array.
|
| 19 |
* - $type: The type of search, e.g., "node" or "user".
|
| 20 |
*
|
| 21 |
* Default keys within $info_split:
|
| 22 |
* - $info_split['type']: Node type.
|
| 23 |
* - $info_split['user']: Author of the node linked to users profile. Depends
|
| 24 |
* on permission.
|
| 25 |
* - $info_split['date']: Last update of the node. Short formatted.
|
| 26 |
* - $info_split['comment']: Number of comments output as "% comments", %
|
| 27 |
* being the count. Depends on comment.module.
|
| 28 |
* - $info_split['upload']: Number of attachments output as "% attachments", %
|
| 29 |
* being the count. Depends on upload.module.
|
| 30 |
*
|
| 31 |
* Since $info_split is keyed, a direct print of the item is possible.
|
| 32 |
* This array does not apply to user searches so it is recommended to check
|
| 33 |
* for their existence before printing. The default keys of 'type', 'user' and
|
| 34 |
* 'date' always exist for node searches. Modules may provide other data.
|
| 35 |
*
|
| 36 |
* <?php if (isset($info_split['comment'])) : ?>
|
| 37 |
* <span class="info-comment">
|
| 38 |
* <?php print $info_split['comment']; ?>
|
| 39 |
* </span>
|
| 40 |
* <?php endif; ?>
|
| 41 |
*
|
| 42 |
* To check for all available data within $info_split, use the code below.
|
| 43 |
*
|
| 44 |
* <?php print '<pre>'. check_plain(print_r($info_split, 1)) .'</pre>'; ?>
|
| 45 |
*
|
| 46 |
* @see template_preprocess_search_result()
|
| 47 |
*/
|
| 48 |
?>
|
| 49 |
<dt class="title">
|
| 50 |
<a href="<?php print $url; ?>"><?php print $title; ?></a>
|
| 51 |
</dt>
|
| 52 |
<dd>
|
| 53 |
<?php if ($snippet) : ?>
|
| 54 |
<p class="search-snippet"><?php print $snippet; ?></p>
|
| 55 |
<?php endif; ?>
|
| 56 |
<?php if ($info) : ?>
|
| 57 |
<p class="search-info"><?php print $info; ?></p>
|
| 58 |
<?php endif; ?>
|
| 59 |
</dd>
|