Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I'm seeking some help to better understand how to go about creating a custom search results page. I've created search views and facetted search, but they really aren't what we are needing. We are consolidating 4 indexes into one streamlined Drupal account and are needing our search to display results grouped by content type (basic filtering)...we were able to do this in search api (views) but we are also needing to display certain content a specific way. For instance, images should have a thumbnail with no title. Other pieces of content should just list the title name. Here is an example of the search we're trying to replicate: http://www.retrometrookc.org/. (Search for, e.g., belle isle.)

screenshot

In theory this seems really simple but I can't seem to wrap my head around it. If anyone has any suggestions or recommendation, I really would appreciate it!

share|improve this question

2 Answers 2

It sounds like you are almost there but without writing custom templates for each content type I would look at display suite. That way, when you click manage display for each different content type you can choose "custom display settings" and then "search result". This will let you build a different layout for each different content type as a search result (and if you like eventually build your own template files easily based on display suites templates).

Then you go back to your view and choose "Show: Display Suite -> Search Result" and each result will be shown as you have set up in the manage display screen for that type. You can still use all the filters and sorts as you like.

share|improve this answer
    
I'll definitely take a look at Display Suite. I was using CCK and it wouldn't give me the option to remove the title. Hopefully display suite will! –  kellie Jun 13 '12 at 19:17
    
Yes, display suite has the option for no page titles, but you may have to turn it on in the settings/extras page. –  7wonders Jun 13 '12 at 20:56

Try this

<?php
/**
 * Format the result page of a search query.
 *
 * Modules may implement hook_search_page() in order to override this default
 * function to display search results. In that case it is expected they provide
 * their own themeable functions.
 *
 * @param $results
 *   All search result as returned by hook_search().
 * @param $type
 *   The type of item found, such as "user" or "node".
 *
 * @ingroup themeable
 */
function theme_search_page($results, $type) {
  $output = '<dl class="search-results">';

  foreach ($results as $entry) {
    $output .= theme('search_item', $entry, $type);
  }
  $output .= '</dl>';
  $output .= theme('pager', NULL, 10, 0);

  return $output;
}
?>

Read more here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.