ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Search simple_form not displaying correct template

March 21, 2011 7:15pm

Subscribe [2]
  • #1 / Mar 21, 2011 7:15pm

    Paul Phillips

    12 posts

    I have the following search form:

    {exp:search:simple_form search_in="entries" status="not closed" form_id="search_form"}
                <fieldset>
                  <div class="input-text">
                    <label for="search"></label>
                    <input type="text" name="keywords" id="search" class="input" />
                  </div>
                  <input type="submit" name="search_btn" class="search"  value="search" />
                </fieldset>
               {/exp:search:simple_form}

    When a search is performed and no results are found it uses the default no results template, which I guess is a flat-file template somehwere. When this happens the URI is “/index.php”. Kind of weird, from the docs I would have guess “search/noresults”. But I digress…

    The real issue is that when search results *are* found the template that’s loaded is the default home page with the URI “search/results/8bcdfa93d2668e59c3fa520fb33e7675/” (i.e. no search results displayed whatsoever).

    What am I doing wrong? Am I supposed to create the /search/results/ template myself? The doc describes “search/results/” as if it already exists. I don’t see why it wouldn’t since “search/noresults/” exists.

    EDIT: forgot to mention version 2.1.3 build 20101220

  • #2 / Mar 21, 2011 8:47pm

    Cheif

    626 posts

    You do create the template yourself as desribed:

    The search results are displayed on the page you specify as the result_page= page. Results are displayed with the Search Results tag.

    To draw up a result template use the “Search results” tag
    http://ellislab.com/expressionengine/user-guide/modules/search/results.html

    Also, the URL for no results must be some form of basic EE functionality but also mentioned in the docs:

    You may specify a particular Template to display in the case when there are no results. This takes a standard “Template_Group/Template” as input.

  • #3 / Mar 22, 2011 12:57pm

    Lisa Wess

    20502 posts

    Hi, Paul, and thank you Cheif!

    You can set the no results template yourself as well, have a look at the no_result_page= parameter.

    To set the result page, you would use result_page=, which is the one where Cheif was saying would take a template group and template.  Then you use the results tag in that specified template.

    Does that help?

  • #4 / Mar 22, 2011 3:34pm

    Paul Phillips

    12 posts

    The search results are displayed on the page you specify as the result_page= page. Results are displayed with the Search Results tag.

    Cheif, I think you’re reading between the lines. No where in that statement does the doc say the page doesn’t exist and that you must create it. In fact, the “result_page=” link hints to the template already existing. There’s no doubt the doc is vague and confusing in this matter.

    I think the docs should be updated to reflect the fact that the search results page does not exist by default, in contrast to the no results page.

    From: http://ellislab.com/expressionengine/user-guide/modules/search/simple.html#par_result_page

    The Template_Group/Template where you would like the search results to be shown. If you do not specify this parameter, then it will default to “search/results”, which is the default location of the search results Template.

    Why have a “default location” if that default location doesn’t exist? That makes no sense. This could really use some BOLD red text that says “NOTE: The search results template does not exist by default. You must create it.”

  • #5 / Mar 23, 2011 8:43am

    John Henry Donovan

    12339 posts

    Paul,

    Why have a “default location” if that default location doesn’t exist? That makes no sense. This could really use some BOLD red text that says “NOTE: The search results template does not exist by default. You must create it.”

    True there could be a better explanation of this

    I think what is meant by default is that is you go ahead and create search/results then you don’t have to include a parameter for that location. If you decide you want to display your search results elsewhere then you need to change that parameter.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases