| 1 |
<?php
|
| 2 |
// $Id: search-result.tpl.php,v 1.1.2.2 2008/10/24 08:19:17 jwolf Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file search-result.tpl.php
|
| 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 existance 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 |
<div class="search-result <?php print $search_zebra; ?>">
|
| 50 |
<dt class="title">
|
| 51 |
<a href="<?php print $url; ?>"><?php print $title; ?></a>
|
| 52 |
</dt>
|
| 53 |
<dd>
|
| 54 |
<?php if ($snippet) : ?>
|
| 55 |
<p class="search-snippet"><?php print $snippet; ?></p>
|
| 56 |
<?php endif; ?>
|
| 57 |
|
| 58 |
<?php if ($info_split) : ?>
|
| 59 |
<p class="search-info">
|
| 60 |
<?php $info_separator = ''; ?>
|
| 61 |
|
| 62 |
<?php if (isset($info_split['type'])) : ?>
|
| 63 |
<span class="search-info-type"><?php print $info_split['type']; ?></span>
|
| 64 |
<?php $info_separator = ' - '; ?>
|
| 65 |
<?php endif; ?>
|
| 66 |
|
| 67 |
<?php if (isset($info_split['user'])) : ?>
|
| 68 |
<span class="search-info-user"><?php print $info_separator . $info_split['user']; ?></span>
|
| 69 |
<?php $info_separator = ' - '; ?>
|
| 70 |
<?php endif; ?>
|
| 71 |
|
| 72 |
<?php if (isset($info_split['date'])) : ?>
|
| 73 |
<span class="search-info-date"><?php print $info_separator . $info_split['date']; ?></span>
|
| 74 |
<?php $info_separator = ' - '; ?>
|
| 75 |
<?php endif; ?>
|
| 76 |
|
| 77 |
<?php if (isset($info_split['comment'])) : ?>
|
| 78 |
<span class="search-info-comment"><?php print $info_separator . $info_split['comment']; ?></span>
|
| 79 |
<?php $info_separator = ' - '; ?>
|
| 80 |
<?php endif; ?>
|
| 81 |
|
| 82 |
<?php if (isset($info_split['upload'])) : ?>
|
| 83 |
<span class="search-info-upload"><?php print $info_separator . $info_split['upload']; ?></span>
|
| 84 |
<?php endif; ?>
|
| 85 |
</p>
|
| 86 |
<?php endif; ?>
|
| 87 |
</dd>
|
| 88 |
</div>
|