News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Merge Search menu bar option and Search button

Started by James Gryphon, September 05, 2017, 03:44:48 PM

Previous topic - Next topic

James Gryphon

As part of an effort to save space on the page, I thought I'd look into seeing if there is a convenient way to combine the two Search buttons.

My concept is to have it so that if the user presses the "Search" button without putting any text in, it simply redirects him to the advanced search page. The forum can determine whether any text is being searched for, hence the error_invalid_search_string, so in principle it doesn't seem like it should be hard.

Has anyone done anything like this before, and do y'all have any advice where to start in doing something like this? I have to confess that Search.php looks fairly intimidating.

Sir Osis of Liver

If you want to save space, just eliminate the quick search, members can use advanced search from mainmenu.  I've done that on several forums.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

James Gryphon

Well, that saves space, but not so much time, if the member has to always click on it to pull up the search page for advanced search. (It also incidentally seems to get rid of the ability to search the individual thread.)

That said, looking over it it seems the simplest and most efficient thing to do, if maybe not the 'cutest' in terms of interface design, would be to just put an advanced search link next to the regular one and don't change how the normal search button works.

Sir Osis of Liver

Quote from: James Gryphon on September 06, 2017, 07:00:22 PM
That said, looking over it it seems the simplest and most efficient thing to do, if maybe not the 'cutest' in terms of interface design, would be to just put an advanced search link next to the regular one and don't change how the normal search button works.

Believe I've seen that in some themes, shouldn't be too difficult to do.  Will see if I can find it.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver



<form class="floatright" id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
<a href="', $scripturl, '?action=search;advanced" title="', $txt['search_advanced'], '"><img id="advsearch" src="'.$settings['images_url'].'/filter.gif" align="middle" alt="', $txt['search_advanced'], '" /></a>
<input type="text" name="search" value="" style="padding: 1ex; width: 140px;" class="input_text" />&nbsp;
<input type="submit" name="submit" value="', $txt['search'], '" style="padding: 1ex; font-weight: bold; width: 11ex;" class="button_submit" />
<input type="hidden" name="advanced" value="0" />';

// 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'], '" />';

echo '
</form>';



Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Advertisement: