Full ELMS Learning Network documentation
search-result.tpl.php
Error message
User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).- cis7 modules/search/search-result.tpl.php
- cle7 modules/search/search-result.tpl.php
- ecd7 modules/search/search-result.tpl.php
- elmsmedia7 modules/search/search-result.tpl.php
- harmony7 modules/search/search-result.tpl.php
- icor7 modules/search/search-result.tpl.php
- meedjum_blog7 modules/search/search-result.tpl.php
- mooc7 modules/search/search-result.tpl.php
Default theme implementation for displaying a single search result.
This template renders a single search result and is collected into search-results.tpl.php. This and the parent template are dependent to one another sharing the markup for definition lists.
Available variables:
- $url: URL of the result.
- $title: Title of the result.
- $snippet: A small preview of the result. Does not apply to user searches.
- $info: String of all the meta information ready for print. Does not apply to user searches.
- $info_split: Contains same data as $info, split into a keyed array.
- $module: The machine-readable name of the module (tab) being searched, such as "node" or "user".
- $title_prefix (array): An array containing additional output populated by modules, intended to be displayed in front of the main title tag that appears in the template.
- $title_suffix (array): An array containing additional output populated by modules, intended to be displayed after the main title tag that appears in the template.
Default keys within $info_split:
- $info_split['module']: The module that implemented the search query.
- $info_split['user']: Author of the node linked to users profile. Depends on permission.
- $info_split['date']: Last update of the node. Short formatted.
- $info_split['comment']: Number of comments output as "% comments", % being the count. Depends on comment.module.
Other variables:
- $classes_array: Array of HTML class attribute values. It is flattened into a string within the variable $classes.
- $title_attributes_array: Array of HTML attributes for the title. It is flattened into a string within the variable $title_attributes.
- $content_attributes_array: Array of HTML attributes for the content. It is flattened into a string within the variable $content_attributes.
Since $info_split is keyed, a direct print of the item is possible. This array does not apply to user searches so it is recommended to check for its existence before printing. The default keys of 'type', 'user' and 'date' always exist for node searches. Modules may provide other data.
<?php
php if (isset($info_split['comment'])): ?>
<span class="info-comment">
<?php print $info_split['comment']; ?>
</span>
<?php endif; ?>
?>
To check for all available data within $info_split, use the code below.
<?php
php print '<pre>'. check_plain(print_r($info_split, 1)) .'</pre>'; ?>
?>
See also
template_preprocess_search_result()
- ctools_search_result_content_type_render in sites/
all/ modules/ ulmus/ ctools/ plugins/ content_types/ search/ search_result.inc - Render the custom content type.
- ds_search_search_page in sites/
all/ modules/ ulmus/ ds/ modules/ ds_search/ ds_search.module - Implements hook_search_page().
- template_preprocess_search_results in modules/
search/ search.pages.inc - Process variables for search-results.tpl.php.
Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.
- comment_node_view in modules/
comment/ comment.module - Implements hook_node_view().
- ctools_search_result_content_type_render in sites/
all/ modules/ ulmus/ ctools/ plugins/ content_types/ search/ search_result.inc - Render the custom content type.
- ds_search_apachesolr_index_document_build in sites/
all/ modules/ ulmus/ ds/ modules/ ds_search/ ds_search.module - Implements hook_apachesolr_index_document_build().
- ds_search_ds_fields_info in sites/
all/ modules/ ulmus/ ds/ modules/ ds_search/ ds_search.module - Implements hook_ds_fields_info().
- ds_search_search_page in sites/
all/ modules/ ulmus/ ds/ modules/ ds_search/ ds_search.module - Implements hook_search_page().
File
modules/search/search-result.tpl.php- <?php
-
- /**
- * @file
- * Default theme implementation for displaying a single search result.
- *
- * This template renders a single search result and is collected into
- * search-results.tpl.php. This and the parent template are
- * dependent to one another sharing the markup for definition lists.
- *
- * Available variables:
- * - $url: URL of the result.
- * - $title: Title of the result.
- * - $snippet: A small preview of the result. Does not apply to user searches.
- * - $info: String of all the meta information ready for print. Does not apply
- * to user searches.
- * - $info_split: Contains same data as $info, split into a keyed array.
- * - $module: The machine-readable name of the module (tab) being searched, such
- * as "node" or "user".
- * - $title_prefix (array): An array containing additional output populated by
- * modules, intended to be displayed in front of the main title tag that
- * appears in the template.
- * - $title_suffix (array): An array containing additional output populated by
- * modules, intended to be displayed after the main title tag that appears in
- * the template.
- *
- * Default keys within $info_split:
- * - $info_split['module']: The module that implemented the search query.
- * - $info_split['user']: Author of the node linked to users profile. Depends
- * on permission.
- * - $info_split['date']: Last update of the node. Short formatted.
- * - $info_split['comment']: Number of comments output as "% comments", %
- * being the count. Depends on comment.module.
- *
- * Other variables:
- * - $classes_array: Array of HTML class attribute values. It is flattened
- * into a string within the variable $classes.
- * - $title_attributes_array: Array of HTML attributes for the title. It is
- * flattened into a string within the variable $title_attributes.
- * - $content_attributes_array: Array of HTML attributes for the content. It is
- * flattened into a string within the variable $content_attributes.
- *
- * Since $info_split is keyed, a direct print of the item is possible.
- * This array does not apply to user searches so it is recommended to check
- * for its existence before printing. The default keys of 'type', 'user' and
- * 'date' always exist for node searches. Modules may provide other data.
- * @code
- * <?php if (isset($info_split['comment'])): ?>
- * <span class="info-comment">
- * <?php print $info_split['comment']; ?>
- * </span>
- * <?php endif; ?>
- * @endcode
- *
- * To check for all available data within $info_split, use the code below.
- * @code
- * <?php print '<pre>'. check_plain(print_r($info_split, 1)) .'</pre>'; ?>
- * @endcode
- *
- * @see template_preprocess()
- * @see template_preprocess_search_result()
- * @see template_process()
- *
- * @ingroup themeable
- */
- ?>
- <li class="<?php print $classes; ?>"<?php print $attributes; ?>>
- <?php print render($title_prefix); ?>
- <h3 class="title"<?php print $title_attributes; ?>>
- <a href="<?php print $url; ?>"><?php print $title; ?></a>
- </h3>
- <?php print render($title_suffix); ?>
- <div class="search-snippet-info">
- <?php if ($snippet): ?>
- <p class="search-snippet"<?php print $content_attributes; ?>><?php print $snippet; ?></p>
- <?php endif; ?>
- <?php if ($info): ?>
- <p class="search-info"><?php print $info; ?></p>
- <?php endif; ?>
- </div>
- </li>
-