By terryit3 on
How do you configure your search results to display an image thumbnail?
I have a gallery of over 10,000 images, and I need thumbnails in my search results.
I've found some information pertaining to the theme_search_item function in the search.module file, but I guess I am too dumb to understand how to implement it.
This question has been asked a bunch of times on the support forums, but I couldn't find a post that had any replies.
I really need help with this! I need this live before the site launches.
Thanks in advance,
Terry
I am using Drupal 5.9 and Image module 5.x-1.6 if that helps.
Comments
What you're trying to do is
What you're trying to do is known as "Overriding Theme Functions" in drupal-speak. Did you find Customize the search results page in your searches?
You need to copy the theme_search_item function from the search.module file into the appropriate theme file (if you're using a phptemplate based theme, it would be the template.php file in your theme's directory), rename it to phptemplate_search_item (assuming you're using a phptemplate based theme, if not see the link above), and then alter it as you wish. The $output you return will be your themed search item. For example, if you simply put
All your search items should appear like: Hello World (though I've never tried this, lol).
If you're not sure what info you have available to you to use in forming your $output you can add the following to your function (just remember to remove it when you're done):
===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime." -- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz
I have tried the advice you
I have tried the advice you have given me, but I still can't get images or thumbnails to appear.
I added the:
and it returned ' . $node . ' instead of the node title and information.
It may be asking too much, but could you please post some code that I could possibly use to include the image?
I thought that I had found what I needed on this thread, http://drupal.org/node/86987 but it was a dead end as well.
Thanks again!
I'm not using the image
I'm not using the image module so this is a complete guess, but try putting the following in your template.php:
===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime." -- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz
Tried it, but nothing has
Tried it, but nothing has changed :(
I'm using the NewsFlash theme from RoopleTheme, so it is a PHPTEMPLATE compatible theme.
I played with it some, and I
I played with it some, and I can confirm that the following works for imagefield images (with imagecache providing the thumbnails):
You can try the following:
As i said, i don't use the image module, so I have no clue if that will work. If it doesnt, you'll have to play with the "if ($item['type'] == 'Image') {" block to get it to work with the image module (and 'Image' should be the content type name of your image content type).
===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime." -- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz
You are awesome! The code
You are awesome!
The code worked and images are now being displayed in my search results.
Thanks again,
Terry
wow-- that was pure luck,
wow-- that was pure luck, lol. I always have to have a live test site to get the code correct. glad it worked for ya... and you're welcome ;-)
===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime." -- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz
thanks!
Hey Worldfallz,
thanks for your support.. not the first time I appreciate your efforts here, so thanks for the time you invest here :)
The posted code is just what I needed to get futher on my project!
Happy to help and thanks for
Happy to help and thanks for noticing and commenting back. ;-)
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
subscribed.
subscribed.
subscribing
subscribing
Can U help me with my site?
Can U help me with my site? This code not work for me. I've using Fusion theme.
My site is http://e-oglasi.biz