Page 1 of 1
[Solved] Define a page to display search results in
Posted: Tue Jan 19, 2010 9:34 pm
by aletsix
Hi all,
After 3 hours of bravely 8) trying to find a way to display the results from the results module in a specified page (different to the one where the search was performed) I've decided to give up

. Has anyone attempted to do something like this and want to share his success story?
Ive found only 1 post thread in this forum but the code that they are suggesting doesn't match with the one i have. I am using the latest version of CMSMS (1.6.6) so the search module must be the latest one too. I have a few files in the search module folder and looked through al of them but i can't seem to understand the architecture of the code.
Any help will be greatly appreciated!
Re: Define a page to display search results in
Posted: Tue Jan 19, 2010 11:26 pm
by tyman00
First and foremost... the help is your friend
The help for the "Search" module in the Extensions menu will point you in the right direction. Look at the available attributes for the {Search} tag.
Re: Define a page to display search results in
Posted: Wed Jan 20, 2010 4:48 am
by aletsix
I have read the search help and found this
(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 ie {search resultpage="searchresults"}
Problem is that I am a newbie with php

and dont know where should I add the tag {search resultpage="searchresults"}. What i have done so far is create a template (named "searchresults") that I would like to use to display the results including the {content} tag and then a new page (named "searchresults" as well) using that template. That was the easy bit but now the question is to what file should I add the definition {search resultpage="searchresults"} ? There are 3 files where I can potentially add this:
Search.module.php
en_US.php
action.default.php
and all of this I have worked out in 5 hours

! hope that I am at least in the right track....any help to this lost soul will be much appreciated
Cheers
Re: Define a page to display search results in
Posted: Wed Jan 20, 2010 5:01 am
by tyman00
You really need to spend some time familiarizing yourself with the system. Read through the wiki, read through the sticky posts on the forum and read the default content that is installed with CMSMS.
I'm normally one to push people to figure it out on their own because you don't learn otherwise. But I'm tired so I am just going to tell you. Go to the template that you are using for the page that will have the search in it. You need to look inside the template for the {Search} tag and replace it with your {search resultpage="searchresults"} tag. You are making it much more difficult than it needs to be. There is generally no need to modify any of the PHP files, in fact we discourage it because we can't support hacked/modified files and any changes are overwritten by upgrades.
[Solved] Define a page to display search results in
Posted: Wed Jan 20, 2010 5:22 am
by aletsix
Holy sheet :o I was trying to understand the php code for hours thinking the answer was there and it was something as simple as this !. Thanks a lot mate...I feel so dumb right now
Cheers
Re: Define a page to display search results in
Posted: Wed Jan 20, 2010 3:24 pm
by tyman00
Glad you understand now
Please add [Solved] to the topic title. Thanks!