News:

Wondering if this will always be free?  See why free is better.

Main Menu

Search Focus Dropdown

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

Previous topic - Next topic

Brettflan

Google something like "javascript form target" and you should find articles describing that sort of thing.

Spacecadet

I installed the "Search Focus Dropdown" and It is not working properly. I found the code and know there is something wrong but I don't know how to fix it, can anyone help please. Here is the code.

<form id="search_form" style="margin: 0;" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
<input type="text" name="search" value="" class="input_text" />&nbsp;';

// 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" id="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" id="search_scope">
<option value="board" selected="selected">', $txt['search_scope_board'], '</option>
<option value="all">', $txt['search_scope_all'], '</option>
</select>';

echo '
<input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" />
<input type="hidden" name="advanced" value="0" />
</form>';

Joker™

Quote from: Spacecadet on June 09, 2010, 05:54:13 PM
I installed the "Search Focus Dropdown" and It is not working properly. I found the code and know there is something wrong but I don't know how to fix it, can anyone help please. Here is the code.

<form id="search_form" style="margin: 0;" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
<input type="text" name="search" value="" class="input_text" />&nbsp;';

// 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" id="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" id="search_scope">
<option value="board" selected="selected">', $txt['search_scope_board'], '</option>
<option value="all">', $txt['search_scope_all'], '</option>
</select>';

echo '
<input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" />
<input type="hidden" name="advanced" value="0" />
</form>';



would be much better if u tell the author what problem are you facing , i mean what is not working properly
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Spacecadet

The drop down menu is not there. It looks like it always did.

adbrad

you have to be in a board or topic for it to show up

Spacecadet


Brettflan

That seems to be a common source of confusion... maybe I should just add in a dropdown for the index as well which has only the one entry ("Entire forum")? I could see that being a source of confusion as well, though. Hmm.

adbrad

i think that would be an improvement as it shows on every page on this forum a lot of webmasters will be more used to seeing it that way

knightofdoom

Glory is fleeting, but obscurity is forever.
Web Designer Sri Lanka

Brettflan


knightofdoom

Glory is fleeting, but obscurity is forever.
Web Designer Sri Lanka

Shannar

Why mod don't find anything on child boards? How I can fix it?
Sorry for terrible English. My native language is C++ Russian.

Brettflan

Quote from: Shannar on June 14, 2010, 06:48:38 AM
Why mod don't find anything on child boards?

As far as I know, that's just how in-board searches work. They search the board you're in, not child boards.

Quote from: Shannar on June 14, 2010, 06:48:38 AM
How I can fix it?

I guess you could dig into the code and add in that functionality.  :P
Seriously though, I guess I could potentially add something like that in, though I wouldn't want to change the way the default option works since that's expected behavior. Perhaps a new dropdown option, "This board and child boards"? That reads a bit long though, and would stretch out the width of the dropdown box quite a bit, which wouldn't really be good. So, I'm not so hot on the idea.

Shannar

Quote from: Brettflan on June 14, 2010, 06:59:55 AM
I guess you could dig into the code and add in that functionality.  :P

I try, but bad understood code.  :-\

Quote from: Brettflan on June 14, 2010, 06:59:55 AM
Perhaps a new dropdown option, "This board and child boards"?

Maybe. How about "This board (full)" or else? And if user switch "Show child boards on every page inside boards, not just the first." -- then use this option as default?
Sorry for terrible English. My native language is C++ Russian.

Bugo

if ($s_scope == "all")
{ //if searching "entire forum", remove the board+category links already added to the linktree
array_pop($context['linktree']);
array_pop($context['linktree']);
}

There is two identical lines - so it should be?

Brettflan

Quote from: Bugo on June 17, 2010, 12:57:18 PM
There is two identical lines - so it should be?
Yes. It's removing two entries from the linktree.

Joker™

bro i want to add google search also in ur mod.this is the code in using at my site for google search, but i have seperate area to enter text to make google search , i would like to merge it with ur mod.


// Google Search your site Start
echo'
<div>
<form method="get" action="http://www.google.com/search" target="_blank">
<img alt="animedk.net" src="'.$settings['default_theme_url'].'/images/google.gif" width="61" height="24" align="middle" />
<input type="hidden" name="sitesearch" value="', str_replace("/index.php", "", $scripturl), '" />
<input type="text" name="q" size="41" maxlength="255" value="" />
</form>

</div>';


like on smf we have option 'Entire site' which takes us to google search , i would like it as 'Google Search' and will take users to google search.
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Brettflan

#117
A guy added it earlier, you might get in contact with him.
http://www.simplemachines.org/community/index.php?topic=293057.msg2567481#msg2567481


Actually though, I was already thinking of going ahead and adding Google site search in the dropdown for the next version, with an option in the Admin panel to not show it. I'll probably have time to do that in a few days or so, but no promises.


EDIT: OK, I decided to rework and clean up the mod package while I was at it, and it's taken longer than I expected. Current target for release is some time late next week, since I'm heading off on a short vacation tomorrow.

Joker™

Quote from: Brettflan on June 26, 2010, 04:22:21 PM
A guy added it earlier, you might get in contact with him.
http://www.simplemachines.org/community/index.php?topic=293057.msg2567481#msg2567481


Actually though, I was already thinking of going ahead and adding Google site search in the dropdown for the next version, with an option in the Admin panel to not show it. I'll probably have time to do that in a few days or so, but no promises.


EDIT: OK, I decided to rework and clean up the mod package while I was at it, and it's taken longer than I expected. Current target for release is some time late next week, since I'm heading off on a short vacation tomorrow.

no reply from his side. plz have a look at my request after u vacations :)
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Brettflan

Released 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

The "Google" site-search option can be disabled in the Admin panel by going to Forum->Search->Settings and unchecking the new option there.


Advertisement: