default userpic

Search form returns blank page

Vote 0 Votes

For some time now the search form on my blog hasn't been working, and I can't work out why. If you try to do a search, it thinks for a bit and then comes up with a completely blank page. The searches do appear in the activity log, so the search script is clearly partly working, just not returning a results page.

I upgraded to 4.25 today in the hopes that would fix the problem, and even copied the default search templates over my own, but the problem still occurs.

Everything else is working perfectly. You can see the site at aldenbates.com.

Reported on Movable Type 4.2

11 Replies

| Add a Reply
  • If you do a view-source on the search results page, it is generating HTML. It also appears that you are using the 3.X search templates. Those will probably need to be replaced with the 4.X templates.

  • The default.tmpl in my search_templates directory is the one from the latest release of MT. Is that not what MT uses to generate the search output?

    When I do a view source on the results page, I don't get anything at all (I'm using Firefox - perhaps that's the difference?).

  • Dear Alden,

    Nice to see your here!

    What happens if you just replace your 'search results' system template with say 'X'

    Is this 'X' displaying after you perform a search?

    Cheers,
    Mihai

  • Alden, I've just went to your web site and figured out that your issue is quite simple!

    Just replace your form method from 'post' to 'get'!

    <form method="post" action

    Should become:

    <form method="get" action

    I didn't include your action value to not feed spam boots ;)

    Cheers mate,
    Mihai Bocsaru

  • Oh, hey Mihai!

    I've made the change so the form will do a post, but the search results are still coming up blank. I even tried renaming the template file and it didn't throw an error.

    Further experimentation reveals that the point of failure is when it runs the 'search_post_render' callbacks. An error thrown before then shows up, one immediately afterward doesn't. It looks like the only search_post_render callback set up by default is the _cache_out function in Search.pm. I'm not sure how to go about debugging what it's doing though.

    I've eliminated all plugins from the equation by disabling them one-by-one and attempting searches - no change, so I don't think any of them are adding a callback.

  • Dear Alden,

    Hello to you!

    Well, may I ask how you've upgraded movable type?

    I wonder if maybe an older version file is still in there.

    Can you remove all the mt folders and make sure that you put back a fresh installation of v4.25?

    Kind Regards,
    Mihai Bocsaru

  • To upgrade it, I uploaded a zip file with everything in the right place, expanded it all, and ran the upgrade script.

    I've done as you suggested and completely removed MT, then loaded all the files back on. The problem with the search is still there. This is seriously puzzling!

  • I see. What if you try to perform a search from within the movable type admin? I mean using the internal admin 'search entries' feature?

    Also, have you tried to just place say 'X' on the search results template and see if you get that 'X' on the search results page?

  • The Dashboard search works fine and gives me a list of results.

    I've tried doing a bunch of things to the search results template, including what you suggested there. Even removing the search template altogether doesn't make a difference - not even a "template not found" error.

    So to sum up what we've found out so far: the actual search appears to be working, however something is going wrong as far as loading the template and displaying it. I'm going to take another look at this problem today and see what more I can find out.

  • Some debugging information I logged at the point right before it runs the post render callbacks:
    $method is set to render
    $format and $tmpl_name are both blank.
    $out is an MT::Template object.

    So it seems like the problem could be that $app->param('Template') is returning an empy string, though I'm not sure what it should be returning under normal circumstances. But at any rate, $out->build() is returning an empty string, which is why the search results page is empty.

  • Problem solved!

    So, it turns out that in the "system templates" section of the back end, there's a "Search Results Template", which MT uses either in preference to or instead of the file in the search_templates directory. The template stored in the database was completely blank, which had the result you'd expect. Once I copied my search template into there, the search results started working again.

    So it looks like the problem was caused by an upgrade not correctly loading the search template into the database at some point along the line!

    Thanks to everyone for the help and advice. :)

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1195 3842

Last Topic: Comment form customization by anisa on Feb 8, 2010

60 184

Last Topic: Dynamic Publishing - Blank Screen by Sivaram M on Dec 15, 2009

955 2987

Last Topic: MT5 - Cookie Problems by Dave Cross on Feb 9, 2010

68 213

Last Topic: How to add Custom Fields by gregoryttp on Feb 5, 2010

19 67

Last Topic: Custom main index page by Richard on Feb 7, 2010

42 169

Last Topic: I want to write my own wordpress plugin by Xarzu on Jan 31, 2010

11 21

Last Topic: Monthly Calendars Help Needed by joe leblanc on Jan 19, 2010

91 326

Last Topic: SpamLookup Keyword Filter 2.1 not work by b.n09 on Nov 17, 2009

52 178

Last Topic: Assets - No options by Chelle on Feb 5, 2010

code.sixapart.com

128 444

Last Topic: ActionStream with Movable Type 5.01 by Parneix on Jan 24, 2010

154 468

Last Topic: URGENT! Help needed w/ Virus by PhilContrino on Feb 1, 2010