Display thumbnail in search result
Error message
- Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; GeSHi has a deprecated constructor in require_once() (line 818 of /home/xenyomed/public_html/sites/all/modules/libraries/libraries.module).
- Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context has a deprecated constructor in require_once() (line 127 of /home/xenyomed/public_html/sites/all/modules/ctools/ctools.module).
- Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context_required has a deprecated constructor in require_once() (line 127 of /home/xenyomed/public_html/sites/all/modules/ctools/ctools.module).
- Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; ctools_context_optional has a deprecated constructor in require_once() (line 127 of /home/xenyomed/public_html/sites/all/modules/ctools/ctools.module).
- Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in _menu_load_objects() (line 579 of /home/xenyomed/public_html/includes/menu.inc).
function modulename_preprocess_search_result(&$variables) {
switch($variables['result']['node']->type) {
case 'nodetype1':
$n = node_load($variables['result']['node']->nid);
$n && ($variables['node'] = $n);
break;
default:
break;
}
search-result.tpl.php
<?php if ($variables['result']['node']->type == 'nodetype1' && isset($variables['result']['node']->field_image[LANGUAGE_NONE][0]['uri'])): ?>
<?php
$image = theme('image_style', array('style_name' => 'thumbnail', 'path' => $variables['result']['node']->field_image[LANGUAGE_NONE][0]['uri']));
?>