All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

No results when no query?

leeaston 31 Mar 2014 07:38 question, complete

www.website.com/search?keywords=time works great with this {exp:low_search:results encode="no" query="{segment_2}" search:title limit="10" paginate="bottom"} tag on the /search template. When www.website.com/search is visited directly with no query, low_search:results returns every entry, is there a way for it to return no results?

Thank you
Lee

Replies

  1. Low 31 Mar 2014 07:56

    There is no encode="no" parameter on the Results tag. Also, if you're using GET variables for the search query, you don't need the query="" parameter, as that's only for the encoded query in the URI. In fact, GET variables fall outside the scope of segments in EE (ie. there is no segment_2 in the URI you shared).

    So, you will have to check whether there is a query string or not. You can do so by using a conditional around the Results tag with the {current_query_string} variable.

  2. leeaston 31 Mar 2014 08:12

    Thanks for sorting me out and for the {current_query_string} tip.