Search Results: change default view

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
TrZ
Registered User
Posts: 67
Joined: Fri Jul 24, 2009 6:53 pm

Search Results: change default view

Post by TrZ »

Hey guys, I am back with a new question.

I wanna find out how to change the default setting for the search results.
Instead of having show the results as posts.
I would like it to show the results as topics without the user having to manually change it before they click search.

Image

It's automatically set to display results as posts. I want to change it to topics by default.

Any help would be appreciated.
Thanks.
User avatar
HGN
Former Team Member
Posts: 4706
Joined: Wed Dec 03, 2008 1:53 pm
Location: The Netherlands
Name: Alfred
Contact:

Re: Search Results: change default view

Post by HGN »

You can change that in the style templates.

Open styles/<your style>/template/search_body.html
E.g. for vanilla 3.0.6 prosilver
Find

Code: Select all

			<label for="show_results1"><input type="radio" name="sr" id="show_results1" value="posts" checked="checked" /> {L_POSTS}</label> 
			<label for="show_results2"><input type="radio" name="sr" id="show_results2" value="topics" /> {L_TOPICS}</label>
Replace by

Code: Select all

			<label for="show_results1"><input type="radio" name="sr" id="show_results1" value="posts" /> {L_POSTS}</label> 
			<label for="show_results2"><input type="radio" name="sr" id="show_results2" value="topics" checked="checked" /> {L_TOPICS}</label>
Don't forget to refresh the styles templates
TrZ
Registered User
Posts: 67
Joined: Fri Jul 24, 2009 6:53 pm

Re: Search Results: change default view

Post by TrZ »

Thanks man. Works! :)
User avatar
GravityDK
Registered User
Posts: 38
Joined: Mon Feb 22, 2010 7:11 am
Contact:

Re: Search Results: change default view

Post by GravityDK »

Thanks.
yaashul
Registered User
Posts: 331
Joined: Mon Apr 17, 2006 3:21 pm
Location: India

Re: Search Results: change default view

Post by yaashul »

Thanks...it works for advanced search...But it doesn't change the defualt behaviour if someone tried to search using search box... How to change that??
User avatar
tbackoff
Former Team Member
Posts: 7064
Joined: Thu Jun 04, 2009 1:41 am
Location: cheerleading practice
Name: Tabitha Backoff

Re: Search Results: change default view

Post by tbackoff »

Credit to HGN
Open /search.php

Find

Code: Select all

$show_results	= ($topic_id) ? 'posts' : request_var('sr', 'posts');
Replace with

Code: Select all

$show_results	= ($topic_id) ? 'posts' : request_var('sr', 'topics');
Flying is the second best thrill to cheerleaders; being caught is the first.
yaashul
Registered User
Posts: 331
Joined: Mon Apr 17, 2006 3:21 pm
Location: India

Re: Search Results: change default view

Post by yaashul »

Thanks a lot... it works :)
noelcrowley
Registered User
Posts: 32
Joined: Sat Apr 21, 2007 12:39 pm

Re: Search Results: change default view

Post by noelcrowley »

Hi guys,

this works great, but i have one more question.

Can i group the results to the their forum, i.e. all the search results from FORUM1 grouped together then all results from FORUM2 grouped together etc

thanks
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 51451
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Search Results: change default view

Post by stevemaury »

You didn't like the answer I gave you here - http://www.phpbb.com/community/viewtopi ... #p12819251 ? Or you want that to be the default? I don't see how it can be the default, since I don't know how the results of a search of a single forum would be "sorted". But let us know what you want.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
somanath
Registered User
Posts: 67
Joined: Mon Aug 02, 2010 5:36 pm

Re: Search Results: change default view

Post by somanath »

every thing works fine..
but how can i remove the option "Display results as: post" from my board .. not only by removing the code on templates , how can i remove the whole "Display results as: posts" functionality from database..
Locked

Return to “[3.0.x] Support Forum”