Download & Extend

"no results" page not themeable

Project:Drupal core
Version:7.x-dev
Component:search.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

In the search_data function, theme('search_page') gets called if there are search results, but not if there are no search results.

I'm not sure if this was intentional, but the end result seems to be that it's not possible to theme the page corresponding to no search results without a very ugly override of theme_box.

Comments

#1

Status:active» needs review
AttachmentSizeStatusTest resultOperations
115540.patch606 bytesIdleUnable to apply patch 115540.patchView details

#2

same patch as above, but with a clarifying comment on theme_search_page

AttachmentSizeStatusTest resultOperations
115540_0.patch1013 bytesIdleUnable to apply patch 115540_0.patchView details

#3

Version:5.x-dev» 6.x-dev
Status:needs review» needs work

Theme API changes are only going to happen in development versions of Drupal. There might be time for 6.x, but it is already in code freeze.

The method of override does not seem logical to me. I would expect a separate theme function to be called for the no results page.

#4

Version:6.x-dev» 7.x-dev
Category:bug report» feature request
Status:needs work» needs review

I've rerolled this patch for 7.x simplifying it a little. I'm not sure that I agree with drumm that this needs to be it's own theme function. So, I've taken the simplest possible solution. This adds two lines of code, and in the HTML, it should add an empty <dl> </dl>

AttachmentSizeStatusTest resultOperations
115540.patch611 bytesIdleFailed: 9001 passes, 3 fails, 3 exceptionsView details

#5

This is closely related, if not a duplicate of #211141: Add default search result page when search request is empty, and they should be worked together. If you're going to close one of this issues, it should probably be the other one, as this one already has a patch.

#6

Status:needs review» needs work

The last submitted patch failed testing.

#7

#8

Status:needs review» needs work

The last submitted patch failed testing.

#9

Category:feature request» bug report
Status:needs work» needs review

"no results" is a valid search result and the fact that this one particular search result is hard coded into search.module is a bug imo.

Here's an updated patch that addresses this more completely.

AttachmentSizeStatusTest resultOperations
search_noresults_115540.patch2.72 KBIdlePassed: 14686 passes, 0 fails, 0 exceptionsView details

#10

Status:needs review» needs work

Note, this is related to #242048: Replace "blue smurf" in no search results message but distinct. Yes, it's lame the default help text in D6 and earlier mentioned "blue OR smurf" etc. It's a step in the right direction that it's now "bike OR shed". However, it's lame this text is still hard-coded into core at all via help text. It'd be a lot better if this message was controlled by a theme function so you could change it to "Karl OR Marx" if you wanted to without hacking core.

This patch would at least allow a theme to provide its own search-results.tpl.php file and not invoke print search_help('search#noresults', drupal_help_arg()); if it didn't want to.

Big +1 from me. However, the current patch includes <h2>Search Results</h2> without t() in the default template, which is obviously a no-no.

#11

Status:needs work» needs review

In addition to the t() for the "Search results" header, I also fixed the logic in the search-results.tpl.php file so that if we're in the "no results" case, we don't print the <dl> or the pager.

AttachmentSizeStatusTest resultOperations
115540-11.search_noresults.patch2.95 KBIdlePassed on all environments.View details

#12

Status:needs review» reviewed & tested by the community

Great cleanup.

#13

Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks!

#14

Version:7.x-dev» 6.x-dev
Status:fixed» needs review

D6 backport. Tested and working nicely.

AttachmentSizeStatusTest resultOperations
115540-14.search_noresults.d6.patch2.8 KBIgnored: Check issue status.NoneNone

#15

Version:6.x-dev» 7.x-dev
Status:needs review» fixed

This is a large functionality change for Drupal 6. I think it's a won't fix for Drupal 6 (see #3 above).

#16

Version:7.x-dev» 6.x-dev
Status:fixed» needs review

dww thinks maybe we should let Gabor decide on whether it's OK for D6 or not, and I'm certainly OK with that idea.

#17

Status:needs review» reviewed & tested by the community

The patch looks OK to me (basically same as D7 functionality)

#18

Version:6.x-dev» 7.x-dev
Status:reviewed & tested by the community» fixed

I agree this would be nice and all but the way it modifies the search template now making it responsible to output the page title will break many sites who did override this function or use a base theme which did override this function. Unfortunately this breaks backward compatibility in a non-trivial way. Moving back to D7 fixed.

#19

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here