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.

How can I show the simple search resulsts on the same page as the search form?

June 06, 2008 5:48pm

Subscribe [0]
  • #1 / Jun 06, 2008 5:48pm

    Account Inactive

    21 posts

    Any help with this would be greatly appreciated.

    Thanks,
    Robert

  • #2 / Jun 06, 2008 6:31pm

    Justin Hurlburt

    344 posts

    Greetings!

    The tags simply need to be in the same template. For the simple search tag, use the result_page= parameter to direct back to the same template.

    Let us know if you have any questions.

  • #3 / Jun 06, 2008 7:12pm

    Account Inactive

    21 posts

    Justin,

    Thanks for your help.

    That’s exactly what I’m doing and it doesn’t seem to work. Have you actually done this before and know for a fact that it works?

    Cheers,
    Robert

  • #4 / Jun 06, 2008 7:19pm

    Derek Jones

    7561 posts

    Robert, try the simple search on our homepage.  You’ll see that that simple search form in the nav bar is still included on the search results page.  You aren’t nesting tags by chance, are you?

  • #5 / Jun 06, 2008 7:25pm

    Mark Bowen

    12637 posts

    EDIT - Strike everything I just said then - How do you get it to do that then Derek?

    Just pointing your result_page=”“ parameter to the search/index page isn’t going to do anything as you are just going to re-direct to the search page again. You are going to need to have the Search Results Tag on that page too although I think out of the box if you do that straight on the same page you may run into a few problems. I think that it won’t work as when you load the search index page you will get a “Your search did not return any results” message. I could be wrong on that though but you would need to have the results tag on the same page. I still have an impression that this won’t work though. Wouldn’t take long to set it up and try though.

    Out of interest why do you need the search page on the results page?

    Hope you get something sorted soon.

    Best wishes,

    Mark

  • #6 / Jun 06, 2008 7:29pm

    Derek Jones

    7561 posts

    Nothing special Mark, just build your templates so that it has both a search results and a simple search tag somewhere on it.

  • #7 / Jun 06, 2008 7:30pm

    Mark Bowen

    12637 posts

    Ah I see now. So would you embed the search page in the results page perhaps?

    I was trying to embed the results page in the search page very quickly as a test. Seems to work if you do it with the search page in the results page instead though.

    Best wishes,

    Mark

  • #8 / Jun 06, 2008 7:53pm

    Account Inactive

    21 posts

    Hi Derek,

    Thanks for your reply.

    The problem I’m having is that when I first try to load the page I get this EE error displayed, but no other content of any type on the page:

    Search Results:

    Your search did not return any results.
    Return to Previous Page

    This is what my code looks like:

    <div class="form-content serach-box">
                        {exp:search:simple_form id="search_form" name="search_form" result_page="site/search" results="15" search_in="entries" status="open" weblog="writer" where="all"}
                            <label for="keywords">Search:</label>
    
                            <input type="text" name="keywords" id="keywords" value="" size="18" maxlength="100" />
                            <input type="submit" value="submit" class="submit" />
                        {/exp:search:simple_form}
                    </div>
                    <div class="search-result">
                        <h2 class="title results">results</h2>
                        <ul>
                            {exp:search:search_results}
                                <li><a href="http://{auto_path}">{title}</a></li>
                            {/exp:search:search_results}
                        </ul>
                    </div>

    Any help you can offer would be greatly appreciated.

    Cheers,
    Robert

  • #9 / Jun 06, 2008 7:56pm

    Mark Bowen

    12637 posts

    Hi Robert,

    I think you are getting the same thing I got when I very quickly tested this earlier. You will need to embed your search tag code into the results page for it to work. Pretty sure that’s the right way.

    Best wishes,

    Mark

  • #10 / Jun 06, 2008 8:03pm

    Derek Jones

    7561 posts

    Right you cannot visit the search results template without having searched, but embedding is not necessary.  Perhaps the word also will make things clearer here.  As in, in addition to whatever other page(s) you have your simple search tag on, also place it on your results template.

  • #11 / Jun 06, 2008 8:10pm

    Account Inactive

    21 posts

    Derek,

    Thanks for the clarification. Now I understand what I need to do. This is the first time I’ve tried to use the search page to also display the search results. The bottom line seems to be you need a separate search results page.

    Thanks for your help.

    Cheers,
    Robert

  • #12 / Jun 06, 2008 8:12pm

    Derek Jones

    7561 posts

    Yep, sorry for any miscommunication!

  • #13 / Jun 06, 2008 8:14pm

    Mark Bowen

    12637 posts

    embedding is not necessary.  Perhaps the word also will make things clearer here.

    As Derek said yep embedding isn’t necessary. Sorry if that kind of threw things a bit. I just embedded mine as it was quicker just to do that for testing purposes but as Derek said just place the code onto the results page and you should be set.

    Hope you get it working soon.

    Best wishes,

    Mark

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

ExpressionEngine News!

#eecms, #events, #releases