Contao Open Source CMS > Contao forum

Switch to german forum

Index > Feature request > Search module improvements

Ben
Partner
Avatar
Posts: 2126
Atlanta, Georgia, United States
I might be using the Search module on a website I'm working on. From working with this module, the following might be some ideas to consider.

allow search forms to have a results page
Basically, what I'm talking about here is having a search form in the header or footer of a Page layout. A visitor enters the keywords and clicks 'Search'. This search form's target is set to another page (search.html) and displays the results in the main body area of the website. This could be accomplished in the backend similarly to how we set the "Jump to page" for a News archive. Then, we would create another page aliased 'search' that would also have a search form in the body, but no "Results page" set since this is the page where the results should be shown. (Hopefully this makes sense.)

change the styling of the search keyword
I can't seem to find where the styling for the search results keywords are set. I'm talking about how the searched-for-word(s) are wrapped in <b> with the Context words before and after. My suggestion is to change the styling in future distributions of TL from <b> to <span class="searchHighlight"> or something similar.
2007-01-30 19:58
leo
Administrator
Avatar
Posts: 7042
Wuppertal, Germany
Hi Ben,

allow search forms to have a results page
you can do this by creating a custom form (form ID tl_search) using the form generator. There is a little chapter in the user guide regarding this issue. I hope there will be an English version soon.

change the styling of the search keyword
I have added your request to the list.

Regards
Leo
2007-01-30 22:10
Ben
Partner
Avatar
Posts: 2126
Atlanta, Georgia, United States
Leo - thanks for the info on form ID tl_search. I'll look into this on the German user's guide using Babelfish, or wait for the English user's guide. Thanks for adding the search keyword results style change to the roadmap.
2007-01-30 23:22
iconleo:
I hope there will be an English version soon.

Hey Leo
I will have my last exam on the 13th. After that i'll have time to complete the two missing chapters. :D

cheers
Philipp
2007-01-31 11:39
leo
Administrator
Avatar
Posts: 7042
Wuppertal, Germany
Hi Philipp,

I wish you all the best for your exam!

Regards
Leo
2007-01-31 11:50
Ben
Partner
Avatar
Posts: 2126
Atlanta, Georgia, United States
Philipp,

Thanks for generously volunteering your time to translate the documentation! Hopefully you're studying is going well.

I was able to make some sense out of the "allow search forms to have a results page" inquiry by Babelfishing the German documentation. It seems to make sense, although I haven't had an opportunity to try it. Do we basically create a form with a search textbox and submit button that targets another page that has a search form in the main body section and set the form ID to be tl_search?
2007-02-09 18:40
leo
Administrator
Avatar
Posts: 7042
Wuppertal, Germany
Hi Ben,

that's exactly the way to do it - unless you are satisfied with the search form of the module.

There is a basic principle behind it: any front end module has a "built-in" form suitable for most situations. However, if you want to use a custom form, you can set it up with the form generator, assign the form ID and target the page including the module.

Regards
Leo
2007-02-09 19:22
Logan
User
Avatar
Have you gotten this to work? Because I --

> created a custom form,
> gave it the ID tl_search,
> linked it to the page with the "search engine" module on it,
> added a text box and submit button,
> put it on the default layout,
> then tried it out.

It successfully redirects to the appropriate page, but that's it. It didn't actually perform the search. I have to type the query in the search box within the content of the page and hit submit. Then the search works just fine.

Any pointers?
2007-04-12 22:31
Ben
Partner
Avatar
Posts: 2126
Atlanta, Georgia, United States
Logan,

I just did the same thing you mentioned in a test ... no luck here either.
2007-04-13 00:06
Logan
User
Avatar
So how do you add search capabilities to your sites Ben? Or do you just do the same thing that is on the TYPOlight project page and link to the page with the search engine on it?
2007-04-13 00:16
Ben
Partner
Avatar
Posts: 2126
Atlanta, Georgia, United States
I haven't built a site with TYPOlight yet where I integrated a search form into the layout. I'm sure we're missing something simple that Leo could point out.
2007-04-13 00:17
Logan
User
Avatar
Darn Munich timezone difference... heh.
Last edited by logangreer, 2007-04-13 00:52
2007-04-13 00:52
Ben
Partner
Avatar
Posts: 2126
Atlanta, Georgia, United States
Alright ... I got this one figured out. I'm re-listing your steps, with the necessary changes in bold.

> created a custom form,
> gave it the ID tl_search,
> linked it to the page with the "search engine" module on it,
> added a text box with a Field name of 'keywords' and submit button,
> put it on the default layout,
> now it should work for you
2007-04-13 01:05
Logan
User
Avatar
WOW! Thanks very much.

How in the heck did you figure that out???

We should post a tutorial, because I am sure there are more people who want to add something like this on their sites.
Last edited by logangreer, 2007-04-13 02:40
2007-04-13 02:30
Ben
Partner
Avatar
Posts: 2126
Atlanta, Georgia, United States
iconQuote:
How in the heck did you figure that out???

I looked at the code for the search form that worked and realized the search field was named 'keywords'. I figured that for the variables to be passed from one page to another, the form element names should probably match up.

Glad we got it figured out.
2007-04-13 04:19