Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
Hi All,

I have read through the documentation on search form tag and quite easy to deploy. But I couldn't grasp the second option that describes how to couchify the hand coded search regionfor couch to drive its search queries.

Can you please assist with this as the client is more interested in the looks of the hand coded search region.

Thank you.
Hi,

Hand-coding the search form (as opposed to using cms:search_form to generate it) is trivial -
you just need to have a text input named 's' and it'll work. For example, following is the markup for the search box in our docs -
Code: Select all
<form class="search_form" name="search_form" action="http://www.couchcms.com/docs/search/" method="get">
    <label for="search"><strong>Search</strong></label>
    <input type="text" id="search" name="s" value="">
    <input type="submit" value="Go"> 
    <input type="hidden" value="1" name="nc">
</form>

The 'nc' input is to direct Couch not to cache the results.

Hope this helps.
Thanks KK,

that was quite fast. I have the name of the input field being "s" but I did not specify any action url.

The action url would have to be my website url right? or simply couch's. Also the display region where would I have to place that information?

To be honest this is my first time trying to make the search form functional.

Thanks
Toheeb,

There are two different components involved in coding search functionality -
1. The form where the search keywords are inputted
2. The Couch code that uses the keyword inputted above to show the pages found.

What we discussed in the last post was first point where we create the form either using cms:search_form or hand-code it.

The second part is made using the cms:search tag e.g.
Code: Select all
<cms:search limit='10'>
   ...
</cms:search>


The two can be placed on the same template or can be used separately (e.g. the search form is shown on the homapage but the search results are shown on a separate template e.g. search.php).

If the two components are on the same template, you don't need to set the 'action' parameter of the form as by default it will load the same page.

But if the two are on different templates, you need to set the 'action' parameter to the URL leading to the template where you have placed the cms:search code.

In closing, I'd recommend you please copy/paste the exact code given in our docs and play with to get a gist of how things work. Once that is clear, you can begin customising it.

Hope this helps.
Thanks KK,

I understand clearly now.

I will implement and give feedback.

Thanks
Perfect ... Got my search page working.

I just need to implement the first part appropriately.

Thanks Super KK.
You are welcome :)
7 posts Page 1 of 1
cron