Search Block2 users found helpful
I am new in C5 and trying to make custom search block.
Here is my situation:
I have search form on top right area of my site thats global, and I want to have the result appear in the main(body) of my site.
Is this possible in C5?
Coz when I search for something the result appear next to it, and make my body area go downward, and when I use the "post to other page" I ended on two search block, 1 on the top right, and one on the body area.
Can anybody help me with this?
<form id="searchform" action="<?php $this->url('/search/search-results')?>" method="get"> <input name="search_paths" type="hidden" value=""> <input name="submit" type="submit" id="searchsubmit" value=""> <input name="query" type="text" id="s" class="s"> </form>
The you create a "search results" page (just a normal page you add like any other page) and put another search block in the main content area of that page. That search block will automatically pick up any searches sent to it and display results.
Make sure your header search boxes are set to send people to that "search results" page (it's the path in the first line of Mnkras's example, for example '/search/search-results').
Before anything else, Thanks for your respones.
Both your comment helps me to understand the form on C5, but does not solve my problem...
Coz When I search using the search form given by Mnkras, the result always appearing on other search block but in the same page,
in page that has no search block I got no results.
How can I redirect my site to the page where I wanted to appear the result when I am searching..
i.e. I want to be in
when I search on any of my page. Coz I setup the
body as a search block only. so that I only have the header, footer, and the body that contains the search result.
(NOTE that this assumes your site is running at the top-level of its domain name -- like "http://example.com/search_results". If instead you are running in a subdirectory, like "http://example.com/my_concrete_site/search_results", then you would enter "/my_concrete_site/search_results" instead).
If you used Mnkras's code, though, you want to change his first line to this:
<form id="searchform" action="<?php $this->url('/search_results')?>" method="get">
(and again, that assumes the site is at the top-level of the domain name -- change that path accordingly if you're in a subdirectory).
I use the form and instead of the
I used this one
action="<?php echo '/concrete2/index.php/search-result/'; ?>"
And the second one works for me...
I used second approach instead of using the php code, is there any side effect for using the method that I came up???
or I just missed something why I can't use the proper way that you teach me???
The way you did it is easier to understand and easier to change if you want the search box on some pages but not others.
But the other way (that Mnkras showed, where you put that php code into your theme templates) makes the search box automatically appear on every page in the site without you having to add it, and nobody can accidentally remove it or change it.
(Note that you can still add it to every page in the site even doing it your way, by adding it to "Page Defaults" in the Dashboard -> Pages and Themes -> Page Types).
So you just have to decide which is best for you and the people who are managing the website.
<?php $this->url('/search-result'); ?>
Does not seems to work,
There is no "echo".... aha^^
Nways thanks to you...