Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-01-26 13:38:57
- Gillelejer
- New Member
- Registered: 2008-01-26
- Posts: 8
Separate page for search results
Hi
I’m trying to create a separate page for search results.
I’ve created a new section called ‘find’ and a new page also called ‘find’.
The section ‘find’ points to the page’find’
It should be simple enough, but I can’t get this to work:
<txp:search_input label=“Find” wraptag=“p” section=“find” />No matter what, all search results end up on the homepage.
I have testes various sections as target sections without luck.
Thanks.
Offline
#2 2008-01-26 13:40:50
- Gillelejer
- New Member
- Registered: 2008-01-26
- Posts: 8
Re: Separate page for search results
correction: test*ed*! Sorry about that!
Offline
#3 2008-01-26 14:04:12
- Gillelejer
- New Member
- Registered: 2008-01-26
- Posts: 8
Re: Separate page for search results
Well, I kind of solved the problem with this from els:
<txp:if_search>
<txp:else />
<txp:article form=“default” status=“sticky” />
</txp:if_search>
<txp:article form=“default” status=“live” />
But I would still like to have tre results displayed on another section than ‘default’.
Offline
#4 2008-01-26 14:12:56
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Separate page for search results
Gillelejer wrote:
But I would still like to have tre results displayed on another section than ‘default’.
<txp:search_input section="find" />
should work. Did you create a section ‘find’? (sorry, didn’t read…) Does the page for section ‘find’ have an article tag?
Last edited by els (2008-01-26 14:14:51)
Offline
#5 2008-01-26 14:42:21
- Gillelejer
- New Member
- Registered: 2008-01-26
- Posts: 8
Re: Separate page for search results
Hi Els
The page ‘find’ has this article tag: <txp:article searchform=“search_results” />
But even if I use af copy of the default page (with some little sign to show that is indeed a copy) all search results are redirected to the real default page.
I have tryed to redirect to vairous sections without result.
I’m testing on localhost. Can that have any influence?
Offline
Re: Separate page for search results
What XHTML your <txp:search_input label="Find" wraptag="p" section="find" />
outputs?
Els wrote:
Did you create a section ‘find’?
Won’t matter. As <txp:search_input />
doesn’t check if the section exists it just outputs static form. If it doesn’t exist then it would output 404: Not found error message.
Cheers!
Last edited by Gocom (2008-01-26 14:51:34)
Offline
#7 2008-02-03 07:17:46
- azw
- Member
- Registered: 2007-01-29
- Posts: 279
Re: Separate page for search results
Hey, Gillelejer, please let us know if you find the answer. I’m having a similar problem.
Last edited by azw (2008-02-03 07:20:39)
Offline
#8 2008-02-03 10:36:37
- azw
- Member
- Registered: 2007-01-29
- Posts: 279
Re: Separate page for search results
I’ve got it working again. The trick was to make sure that the code is right in three places.
1. on the form that displays the search field (for me it appears on form sidebar_B):
<txp:popup type="c" wraptag="p" />
2. on the page template that receives the search (for me, the search template page):
<h3 class="search_term">Search Term: <txp:page_url type="q" /></h3>
<h5 class="search_count"><txp:article pgonly="1" /><txp:search_result_count /></h5>
<txp:article form="search_results" limit="20" />
(Note: search_term will work once we upgrade to Txp version 4.0.6., page_url type=“q” works with 4.0.5)
3. on the form that displays the search results (for me, search_results form):
<h3><txp:permlink><txp:title /></txp:permlink></h3>
<p><txp:search_result_excerpt /></p>
I hope that helps.
Offline
#9 2008-02-03 11:44:28
- Gillelejer
- New Member
- Registered: 2008-01-26
- Posts: 8
Re: Separate page for search results
Thanks azw, I’ll try that when I upgrade to 4.0.6. Right now I manage with if … else as mentioned above.
Offline
#10 2008-02-03 18:48:27
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Separate page for search results
Gillelejer, in the weblog post about the 4.0.6 release I read this:
Enable separate search section for messy URL mode
Are you using messy URLs? I had not realized that a separate search section was not possible when using messy (I’ve only ever used clean URLs).
Offline
Re: Separate page for search results
Are you using messy URLs? I had not realized that a separate search section was not possible when using messy (I’ve only ever used clean URLs).
Yes, partly. You can use seperate section while using messy urls – only thing is that the <txp:search_input />
tries to use clean urls – or something similiar – haven’t actually used the quite a long time, as it misses flexibly. Etc. this will work: ?s=your-section&q=your-search
.
So it’s possibly required to hand code the search form:
<form method="get" action="<txp:site_url />" id="search">
<label for="search-input">Search:</label>
<input type="text" name="q" value="" id="search-input" class="search" />
<input type="hidden" name="s" value="your-section" />
<input type="submit" value="Search" class="submit" />
</form>
But i’m pretty sure that thing worked back in older versions, around 4.0.3 – as it output <input type="hidden" name="s" value="your-section" />
to the form and used hu
in the action.
Cheers!
Offline
#12 2008-02-03 20:33:54
- Gillelejer
- New Member
- Registered: 2008-01-26
- Posts: 8
Re: Separate page for search results
Yes, I use messy URLs. I’m sure you have solved the “mysteri”. Thanks!
Offline
Pages: 1