Posted by Wesley Tanaka on February 3, 2007 at 5:19am
11 followers
| 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
#2
same patch as above, but with a clarifying comment on theme_search_page
#3
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
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>
#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
The last submitted patch failed testing.
#7
See: #335122: Test clean HEAD after every commit and http://pastebin.ca/1258476
#8
The last submitted patch failed testing.
#9
"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.
#10
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
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.#12
Great cleanup.
#13
Committed to CVS HEAD. Thanks!
#14
D6 backport. Tested and working nicely.
#15
This is a large functionality change for Drupal 6. I think it's a won't fix for Drupal 6 (see #3 above).
#16
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
The patch looks OK to me (basically same as D7 functionality)
#18
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
Automatically closed -- issue fixed for 2 weeks with no activity.