I just tried this plugin today and noticed that using get as the form submission method does not work. When I use method="get" in the form html tag it returns the no results message. I am not sure if I missed something or maybe something changed in the lastest build of OctoberCMS (build 430)?
I am using the search form example from documentation
<form action="{{ 'search' | page }}" method="get">
<input name="q" type="text" placeholder="What are you looking for?" autocomplete="off">
<button type="submit">Search</button>
</form>
If only works if I change method
<form action="{{ 'search' | page }}" method="post">
<input name="q" type="text" placeholder="What are you looking for?" autocomplete="off">
<button type="submit">Search</button>
</form>
My search results page just has the one line to add the searchResults component
{% component 'searchResults' %}
Obviously using post as the method breaks the pager, since the pager relies on the get method.
Any help is appreciated.
Thanks!
OFFLINE said:
Let's check a few things:
- After the form submission do you see the
q
parameter in your url?- When you
dd(Request::get('q'), Request::all());
before this line do you get an output that contains your search query? If not, could you post the output here?
-
Yes I do see it. The q parameter is present in url for all search words with the correct search word. e.g. when I search for the word yay which appears on my home page, the url shows domain.tld/search?q=yay
-
The output of dd(Request::get('q'), Request::all()); when placed on line 148 of the SearchResults component is:
null
[]
Thanks so much for your help!
I have just tested the plugin on build 430 and everything seems to work as expected. Somehow the GET parameters don't make it throught to php.
What server are you using? Is it possible that you are doint some url rewriting with .htaccess
?
Can you replace the dd(Request...)
with a dd($_GET);
and see what this prints?
OFFLINE said:
I have just tested the plugin on build 430 and everything seems to work as expected. Somehow the GET parameters don't make it throught to php.
What server are you using? Is it possible that you are doint some url rewriting with
.htaccess
? Can you replace thedd(Request...)
with add($_GET);
and see what this prints?
Thanks for your help! I put dd($_GET); on the same line and got a blank array. Based on your suggestion of looking in .htaccess I edited my try_files block in my nginx config(I am using nginx), and added /index.php?$query_string This fixed it. Thanks again for your help!
Sorry I don't understand your problem. You'll have to give some more details about the error if you need help.
1-6 of 6