I have a Drupal 7 installation with about 10 custom types and a custom theme. I have a search form in the site's header displayed with
$block = module_invoke('search', 'block_view', 'form');
print render($block);
This code is in an include file called by my page.tpl.php, it's not actually inside a block.
If there are no search results, the search page displays (mostly) correctly and it uses the search-results.tpl.php template in my theme.
However, if there are search results, I get an unformatted page. It's just the search results (with their associated HTML p tags, etc.) with no site HTML. No head tag, no body tag and none of the custom theme's HTML.
By using advanced search, I have identified, specifically, that one of my custom types is causing this issue. The confusing thing is that this type just has a title and a body text. Other, more complicated types are not causing this issue. When I limit it by type, I get the correct output.
How can I get the search results to show up on a regularly themed page?
EDIT
I have also tried:
echo drupal_render(drupal_get_form('search_form'));