Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-11-03 14:17:27

newnoise
Member
Registered: 2011-02-24
Posts: 35

Sort search output by sections.

Hi,

is there any way to sort my search results by sections?
So that the result site looks like:

News:
result A
result B

Artists:
result C
result D

Contact Page:
result E

Thanks!
noise

Offline

#2 2011-11-03 20:16:06

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Sort search output by sections.

Something like this?

<txp:if_search>
   <txp:article sort="section asc, score desc" />
</txp:if_search>

You can then add the section title with if_different in your search_results form.

Offline

#3 2011-11-04 10:28:26

newnoise
Member
Registered: 2011-02-24
Posts: 35

Re: Sort search output by sections.

perfect that works.

is it possible not to sort by alphabet (as its done now) but on an order I want it to? The page just got 5 sections, so its not too much …

Offline

#4 2011-11-04 20:37:35

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Sort search output by sections.

Maybe with this plugin.

Offline

Board footer

Powered by FluxBB