I want to make possible when users search for something to see thumbnails on the result page. I have Imagecache Thumbs1 preset and every node have thumbnail associated with it. I tried with the advices I found in the forum, but without luck :(

Comments

alby111’s picture

Hi Teri

I have been lookiing for the same thing in the las week and little by little Im begining to understand

that is not so simple. I let you know what do I know so far , but is not a very reliable info ´cause

Im a newy.

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

to your Template.php this file is in your 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 you 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. We have to add in the first line of the function
yourtemplatename_preprocess_search_result(&$variables) ,as you will see in the link I mentioned above

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

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

When you 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 you have to clear the cache, you do so by: going

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

This is all I know for the moment, I have to find out waht 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.
I so the videos from Lullabot.com advance theming and helps a lot.
Please If you find someone developer that helps you, could you please share what ever new info you might get. thanks a lot an good luck !!! alby =)
PS: I use embeded media field
I also suggest you to learn how to use the devel module.
Don t forget to clear the cache when you make changes

Terko’s picture

Thank you Alby :)
I've readed about Theme ovveriding, but I can't find how to invoke the thumbnail. I have Image cache Thumbs1 preset and tried to call it with imagecache-Thumbs1, or just Thumbs1, but without luck. I will try with your advice to clear the cache, maybe there is the problem :)

WorldFallz’s picture

In drupal 6 this is much much easier and you actually don't need to mess with functions in the template.php file. Simply copy the default search template file (search-result.tpl.php) from the modules/search subdirectory to your theme's subdirectory and alter as desired.

kerazyguy’s picture

I'm having the same problem ... I got that file and moved it to my themes sub-directory but as far as "altering" what would i need to do with it to make it only show the thumbnails associated with a certain page type? and a link to that node, and the name of the node? i'm sorry I am no coder...

pratik60’s picture

He does a really great job explaining the process

http://www.midwesternmac.com/blogs/jeff-geerling/adding-images-search-re...