I wonder how to add image with a link to the node, to the result of a search. The image in question, has the field type of emvideo, since I'm using Embedded Media Field module configuration for visitors to post videos on my site. I would like visitors to visit and search for videos and as a result get the title a description and a small image with a link that goes to the node.
any help welcome, I'm a newy! .

Comments

matt2000’s picture

There might be a contrib module to help with you goal, but the way I'd do it as a developer would be to implement the template_preprocess_search_result() in your theme's template.php, and also possible create a search-result.tpl.php template (based on a copy of the file from core search module).

See:

http://api.drupal.org/api/function/template_preprocess_search_result/6

alby111’s picture

I have been lreading little by little Im begining to understand that is not so simple. this is what I

know so far , but is not a very reliable info ´cause Im a newy.

To change anything in a theme , like adding images in the search results, we have to add functions to

our Template.php this file is in our default theme directory.

For the search module, the functions are in the template_preprocess_search_result,
see http://api.drupal.org/api/function/template_preprocess_search_result

IMPORTANT: I understand that When we want to change anything, the drupal way is doing a "Theme

function overriding"
For this we have to add the function we need into the Template.php, located in our default theme

directory.
1. in the first line of the function we have to add
ourtemplatename_preprocess_search_result(&$variables) , see in the link I mentioned above

2. then and also we have to add a search-result.tpl.php in our default theme directory. To do this

you can copy the file from core search module, and place it in your default theme directory.

When we do this, Drupal will go and get the functions from the theme folder instead of getting the

function from the search module. But to make it work we have to clear the cache, we do so by: going to

admin/settings/performance and press the clear cache button.

This is all I know for the moment, I need to know if I want to see the thumbnail from the embeded media field in the search result
I know the field type is "emvideo"
and I also wahnt to get the path var

what do I have to add in the

template_preprocess_search_result
and in the search-result.tpl.php

I know I have to add the name of the variable and a function , but I don´t know how to yet.

Please share what ever new info you

might get. thanks a lot an good luck !!!