PDA

View Full Version : Release: Toggle Search Results between Posts + Threads


Dockaych
10-11-2003, 08:01 PM
Author: Dock

Description:This is a really, really, simple template modification. It basically adds the ability to choose whether to see the search results as posts or threads. I wanted to add this because I found it annoying using the 'simple search', but then realising I wanted to see posts instead of threads.

I realise that it's possible to click on the 'Searched for' text to go back to the search page, but this is nicer IMO :) I don't know whether this is useful for anyone.

EDIT: 1.1 - I changed the code so that it recognises whether it is on threads or posts, and offers to toggle to the other view.
EDIT: 1.2 - I fixed the code so that it doesn't show on the getnew page.

In the 'SEARCH-FORUMS' template, search for:
Search took <b>$searchtime</b> seconds.
and replace with:
Search took <b>$searchtime</b> seconds.

<if condition="$action == 'getnew'">
<else />
<if condition="$search[showposts]">
<b><a href="search.php?$session[sessionurl]$searchquery&showposts=0&do=process">See results as
threads</a></b>
<else />
<b><a href="search.php?$session[sessionurl]$searchquery&showposts=1&do=process">See results as posts</a></b>
</if>
</if>


Example: See attached image

Dockaych
10-11-2003, 11:28 PM
Notes:

This hack will also show up on the "search within this thread" results, but clicking either of the links will make no change to the current page. I should probably try to find a conditional to make it disappear for that page too.

Dockaych
10-19-2003, 07:27 AM
I was wondering if anyone could help me to finish this hack. I still have problems with this code appearing within the 'search this thread' results. I've tried <if condition="$search[searchthread]"><else /> and <if condition="$search[searchthreadid]"><else /> and a wealth of others, but I can't see to find any way to turn off this hack on the 'search this thread' page. :( Can anyone help?