Page 1 of 1

Show result of a search on a given page

Posted: Mon May 21, 2007 6:49 am
by mrbs
Hi!

What code do I use to display the result of a search on a given site?

mrbs

Re: Show result of a search on a given page

Posted: Mon May 21, 2007 7:22 am
by RonnyK
From the help of search, through "Modules -> Search -> Help":
(optional) resultpage="null" - Page to display search results in.
This can either be a page alias or an id.
Used to allow search results to be displayed in a different template from the search form.
If you create a new page, give it a name, on the options-tab, uncheck "show in menu", to make it not visible in the menu. Call that page in the calling of search,

Code: Select all

{search submit="test" searchtext="" resultpage="pagename"}  
resultpage, sets the page to open the results in.
searchtext, sets the default text in the search-box.
submit, sets the label of the search-button.

Ronny

Re: Show result of a search on a given page

Posted: Mon May 21, 2007 7:59 am
by mrbs
I know how to show the form, and when i submit, the right page is shown, but it doesn't show any search results. How do I tell where to submit the result??

Re: Show result of a search on a given page

Posted: Mon May 21, 2007 8:11 am
by RonnyK
The search-module "Search" just searches your own CMS site, for pages that DON'T have the "atrribute NotSearchable". Basically if you have specific text on a content page, the search should find it.

Ronny

Re: Show result of a search on a given page

Posted: Mon May 21, 2007 8:19 am
by mrbs
Well it doesn't  ;)

You can see it in work here:

www.caupo.dk

I understand how it works - but I imagine that I have to tell the CMS where on a specific page I want the search module to display the results... Or have I misunderstood something?

Re: Show result of a search on a given page

Posted: Mon May 21, 2007 8:25 am
by RonnyK
How do you call the search-module in your template page?

You don't have to say where you want to show the results, if you don't specify a resultpage, it replaces the content of the page you where on while requesting the search.

Ronny

Re: Show result of a search on a given page

Posted: Mon May 21, 2007 8:34 am
by mrbs
In the template i call the search form like this:

{search inline="true" searchtext="" resultpage="resultat" submit="Søg"}

Re: Show result of a search on a given page

Posted: Mon May 21, 2007 8:36 am
by RonnyK
Can you try what happens if you remove the "inline"-part.

Ronny

Re: Show result of a search on a given page

Posted: Mon May 21, 2007 8:44 am
by mrbs
Thank you so much! That did it!

mrbs :)