1

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!

2 Answers 2

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.

2
  • 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, 2012 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, 2012 at 20:56
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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