News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Search Focus Dropdown

Started by Brettflan, February 14, 2009, 02:34:48 PM

Previous topic - Next topic

Brettflan

Link to Mod

This mod adds a dropdown to the search field at the top of the page, similar to the one on the official SMF community forum.
When viewing a topic, the dropdown options will be "this topic" (default), "this board", "entire forum", or "Google".
When viewing a board, the dropdown options will be "this board" (default), "entire forum", or "Google".
On any other page, the dropdown options will be "entire forum" (default) or "Google".

The "Google" site-search option can be disabled in the Admin panel by going to Forum->Search->Settings and unchecking the new option there. Similarly, there is another option to enable "Bing" site-search in the same place.
You will also see a list of all your forum's boards there for possible inclusion in the dropdown as choices. These board choices will shown everywhere, just above the "entire forum" option. You can use this to add your "FAQ" or "Support" board (or whatever you like) to the dropdown for easy searching from anywhere in the forum.

Other than English, language strings are also provided for these languages: Brazilian Portuguese, French, German, Italian, Romanian, Russian, Spanish, Turkish.


Note: since support for SMF 2.0 RC1 was removed with version 1.6.0, 1.54 is still available with support for it. Though honestly, if you're still running 2.0 RC1, your forum has been outdated for nearly two years now.


Changelog
version 1.6.1:

  • fix for bug on SMF 1.1.x versions which kept the mod from working at all
version 1.6.0:

  • Complete overhaul of codebase. The old code was a bit kludgy in places. The changes needed for each theme's index.template.php file are very compact now as most of the display code has been consolidated into a couple of separate new files.
  • New "Bing" site-search option. Works the same as the Google option, but (naturally) uses Bing. Defaults to disabled.
  • You can now add whatever boards you want to the dropdown as separate options, to be shown on every page just above the "Entire site" option. Could be useful for your "FAQ" or "Support" board if you have one. NOTE that this is only available in SMF 2.0. If you are using SMF 1.1.x, sorry. Consider upgrading.
  • If you have Visual Verification required for searches (for Guests, or whatever), the search focus will be properly passed through that instead of being lost.
  • Attempted to improve vertical alignment of search form elements.
  • Removed support for old 2.0 RC1 installations; if you're still using it, you should have updated a long long time ago.
version 1.54:

  • support for Antechinus' Prince of Darkness theme outdated release named "Ants_Curve_Variants_20"
version 1.53:

  • better support for Antechinus' newest Prince of Darkness and Chocolate Curvaceous theme releases ("201" versions)
version 1.52:

  • support for installation on SMF 2.0 Final
version 1.51:

  • support for SMF 1.1.12 and 2.0 RC4
  • added built-in Romanian language support, updated German and Russian translations
version 1.5:

  • rewrite of mod to clean up the code and reduce the chance of conflicts with other mods during uninstallation
  • dropdown is now shown on every page
  • new "Google" search option which does a Google site-search for your domain; this option can be disabled in the Admin panel
version 1.44:

  • minor: fixed installation support for SMF 1.1.11 (it somehow got broken on the last update, my mistake)
version 1.43:

  • minor: installation support for SMF 2.0 RC3
version 1.42:

  • minor: installation support for SMF 1.1.11
version 1.41:

  • improved theme support for Antechinus' Prince of Darkness, Blue Steel, and Chocolate Curvaceous variants (looked a bit funky, oops)
version 1.4:

  • support for SMF 2.0 RC2 and Curve theme
  • additional theme support for Antechinus' Prince of Darkness, Blue Steel, and Chocolate Curvaceous variants
  • added built-in French language support
version 1.31:

  • minor: installation support for SMF 1.1.10 and 2.0RC1.2
version 1.3:

  • added support for SMF 1.1.9 and 2.0RC1-1
  • added built-in Spanish and German language support
version 1.2:

  • added support for SMF 1.1.8
  • added built-in Italian and Brazilian Portuguese language support
version 1.1:

  • initial public release.

edi67

#1
Great let me try it

Work perfectly thx

Italian language
// Search field scope mod
$txt['search_scope_topic'] = 'In questo topic';
$txt['search_scope_board'] = 'In questa sezione';
$txt['search_scope_all'] = 'In Tutto il forum';
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Chandy

Thx man :) !

Portuguese Brazil language
// Search field scope mod

$txt['search_scope_topic'] = 'Neste tópico';
$txt['search_scope_board'] = 'Nesta seção';
$txt['search_scope_all'] = 'Tudo no forum';


NHWD

please make this mod compatible to 1.1.8!

Brettflan

Quote from: CL0WNER on February 14, 2009, 10:19:23 PM
please make this mod compatible to 1.1.8!
I'll see what I can do. It will be a few days though until I have time to make an installation of 1.1.8 and work on it.

chrisb

also would like to see it for 1.1.8

blondeamon

Perfect....we look forward to it for 1.1.8
Always looking for the best

www.kamenos.gr  Greek Gaming Community

timned88

#7
i have this installed but i am not seeing any functionality.  do i need to activate it in the admin panel or did something goof?
2.0RC1.


disregard....  cache needed to be cleared.

Mo786

Also waiting for 1.1.8 support. Thanks :)

Brettflan

OK, version 1.2 is now released with support for SMF 1.1.8. It also includes Italian and Brazilian Portuguese language support thanks to edi67 and Chandy.

Kimmie

#10
I have two custom themes and normally I do not have a problem manually editing them however, I seem to be haivng difficulty installing this to their index.template.php files (none of the code that the parser says to look for is in either of them). I was wondering if you could take a look and see what the issue could be because I have no idea where to put this code. Thanks :)


(this is for my benefit so I know which one is which - 19.12 is for remix theme and 23.55 is for Brk theme)

Brettflan

The best way to find the place to edit in index.template.php is to find $txt[182] (SMF 1.1.x) or $txt['search'] (SMF 2.0).
The changes basically consist of moving the submit button to the end of the form (so it shows after the dropdown) and swapping out code within that "if... elseif" code block to add the dropdown on board and topic views.

cybergeneral

I'm using the theme Reference with version 2.0, but when I install the package it says will fail to "index.template" the theme Reference20b.
In fact I install and does not show the Search Focus on the pages.
Can you help?

my forum: www.lgcookiebr.com [nofollow]

Brettflan

Quote from: cybergeneral on March 11, 2009, 07:04:32 AM
I'm using the theme Reference with version 2.0, but when I install the package it says will fail to "index.template" the theme Reference20b.
In fact I install and does not show the Search Focus on the pages.
Can you help?

my forum: www.lgcookiebr.com
Just at a glance I don't even see a search form (normally in the upper right of the page) on your site as a guest. If that search form is visible for users, that's fine, but otherwise the mod will do nothing anyway since that's the form it modifies.

I can't directly support installation of the mod to all possible themes, but I can point you in the right direction. For your theme, edit the index.template.php and find the text "$txt['search']" for your starting point.
To see roughly what needs to be done, you can view the mod listing, and to the right you'll see "Manual Install Instructions for SMF". Submit that form, and refer to the change listed under "./Themes/default/index.template.php" on the resulting page.

The important change is to replace the code which looks like this:
// Search within current topic?
if (!empty($context['current_topic']))
echo '
<input type="hidden" name="topic" value="', $context['current_topic'], '" />';
// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']))
echo '
<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

With this:
// Search within current topic?
if (!empty($context['current_topic']))
echo '
<input type="hidden" name="topic" value="', $context['current_topic'], '" />
<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />
<select name="search_scope">
<option value="topic" selected="selected">', $txt['search_scope_topic'], '</option>
<option value="board">', $txt['search_scope_board'], '</option>
<option value="all">', $txt['search_scope_all'], '</option>
</select>';
// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']))
echo '
<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />
<select name="search_scope">
<option value="board" selected="selected">', $txt['search_scope_board'], '</option>
<option value="all">', $txt['search_scope_all'], '</option>
</select>';

That will add in the dropdown as needed on board views and topic views.

The only other real change I made to that file is to move the submit button so that it shows up after the dropdown rather than in front of it, but that's just a cosmetic change and not actually necessary.

AlenNS

#14
I don't see any change. Even after clearing cache.

Now I see. On Simple Portal and board view there is no dropdown. :)

pinoypetfinder

hi, i havent' update my forum to 1.1.8, where can i download this mod for 1.1.7 ?
[i haven't update because i'm too lazy to update all my installed mods just yet :/]

Brettflan

Quote from: pinoypetfinder on March 24, 2009, 10:44:17 PM
hi, i havent' update my forum to 1.1.8, where can i download this mod for 1.1.7 ?
[i haven't update because i'm too lazy to update all my installed mods just yet :/]

I don't plan to backport the mod to older versions of SMF.
However, you're welcome to try applying the 1.1.8 mod changes to see if they will work directly in 1.1.7 without any changes. Maybe, maybe not.

KameL

Here is the spanish, spanish-latin and spanish-utf8 translation:
//SEARCH FOCUS DROPDOWN
$txt['search_scope_topic'] = 'Este tema';
$txt['search_scope_board'] = 'Este sub-foro';
$txt['search_scope_all'] = 'Todo el foro';
//FIN SEARCH FOCUS DROPDOWN




Chit-Chat ChatterBox Boss

I installed this but see no changes. Any ideas?
Chit-Chat ChatterBox

Our site is open to everyone. It is a resource for anyone and everyone to talk about anything and everything you could possibly think of. It's a great place to come and talk, ask questions, or just simply hang out. We offer many great features. All we ask is that you follow by the site rules. Hope to see you around!
www.chitchatchatterbox.com
Remember in the "Referral" box to put "Caleb" while registering.

Brettflan

Quote from: Chit-Chat ChatterBox Boss on May 16, 2009, 01:55:43 PM
I installed this but see no changes. Any ideas?

Is it possibly related to the quoted post below?

Quote from: AlenNS on March 11, 2009, 09:47:31 PM
I don't see any change. Even after clearing cache.

Now I see. On Simple Portal and board view there is no dropdown. :)

If not, it might be a while before I can help you further... I just had a major house fire a couple of days ago and everything is basically helter skelter.

Advertisement: