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

NanoSector

Brettflan: template files are not supposed to load language files, are you sure the mod is doing this? (if yes we'll need to take a second glance over this)
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Brettflan

Quote from: Yoshi2889 on January 06, 2013, 08:38:55 AM
Brettflan: template files are not supposed to load language files, are you sure the mod is doing this? (if yes we'll need to take a second glance over this)
This mod does not use a separate source file, but it does have a separate template file to simplify inclusion in multiple themes. I suppose this "template file" is not really structured or used as one since it's simply include()ed from another template file to use its inline code (no functions added), but the code is for frontend template use. It also simplifies making a customized version of the dropdown box for different themes if desired.

I could add the loadLanguage call to the appropriate existing source file(s) instead, but I'm trying to keep this package as clean and compartmentalized as possible so that it's less likely to conflict with other mod packages (mainly IRT installation and uninstallation order conflicts from changing the same section of code and such). I also have seen no reason not to add the loadLanguage call right where it's needed there; if there is some fundamental reason it shouldn't be where it is, please do let me know.

demlak

#302
im sorry for not reading 16 pages...
but is it possible to not show the dropdown menu at all, if there is only one option available? for example when there is only "entiry forum" available?

EDIT:
nevermind.. im using a different mod to enhance search =)

iain sherriff

main page is fine and the search works brilliantly everywhere now thanks.
only visual faults are in board view and topic view (see att)

is that just a bit od code we have there by mistake? can you guess what it might be ?

thanks
SMF 2.0.12

Brettflan

Quote from: iain sherriff on January 09, 2013, 04:56:21 AM
main page is fine and the search works brilliantly everywhere now thanks.
only visual faults are in board view and topic view (see att)

is that just a bit od code we have there by mistake? can you guess what it might be ?

thanks
You do appear to have something extra added there by mistake. Did you figure it out yourself? I followed the link in your sig to see if I could check the page source for an inkling of what that extra dropdown is for, but the forum in your sig looks fine at a glance (default theme though, of course).

iain sherriff

my link is to my forum . the errror is on the one I moderate whichI didnt install............
SMF 2.0.12

Brettflan

Quote from: iain sherriff on January 09, 2013, 05:53:26 AM
my link is to my forum . the errror is on the one I moderate whichI didnt install............
Well, good luck with it.

iain sherriff

...does that mean you cant guess what the code may be ?
SMF 2.0.12

Brettflan

Quote from: iain sherriff on January 09, 2013, 08:33:42 AM
...does that mean you cant guess what the code may be ?
A screenshot isn't much to go on for determining what was done that messed it up, especially since that extra empty dropdown after the search button wouldn't exist in a normal installation of this mod package.
Presumably some extra code ended up in there, but I have no way of knowing what without a link to the site or the contents of the theme's index.template.php file. Actually, you could probably spot the extra code just looking at that file yourself.

iain sherriff

thanks  :)
I'll compare it to mine and see what I can find. The one I moderate is a massive forum and we have real problems trying to get people to use search rather than just starting another topic...your mod is going to go a long way to helping that situation.
SMF 2.0.12

iain sherriff

From the index.template.php

Is it the bit between ***   ***?

<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>';   ***

      echo '</form>';

      // Show a random news item? (or you could pick one from news_lines...)
      if (!empty($settings['enable_news']))
         echo '
            <h2>', $txt['news'], ': </h2>
            <p>', $context['random_news_line'], '</p>';
SMF 2.0.12

Brettflan

Quote from: iain sherriff on January 09, 2013, 06:02:30 PM
From the index.template.php

Is it the bit between ***   ***?
It's from well before where you have the start location marked, to the end of where you have it marked. Some of the code in there IIRC shouldn't be removed though, it's code which exists even without this package interspersed in there. What you have in there is the old pre-1.6.0 code for this mod, by the way; looks like an older version of this package wasn't uninstalled properly before installing the latest version. That could cause all sorts of problems, leaving bits of old packages installed without uninstalling them properly.
You'd probably do better to uninstall all packages, upload a fresh copy of all SMF and theme files, and then re-install all packages to be sure you don't have more leftover code in there. Then be more careful in future about package handling, not just deleting or overwriting packages without uninstalling them through the admin panel first.

iain sherriff

thanks.............as I said not one that I installed   ???
SMF 2.0.12

Brettflan

Quote from: iain sherriff on January 10, 2013, 11:45:14 AM
thanks.............as I said not one that I installed   ???
Well, again, good luck with it.  :)

iain sherriff

hi.
Rebuilding the above site with Anecdota theme.
All installed well and works with defaul theme. I did a manual install on Anecdota as your search didnt work with that.
I now have the drop down menu but am missing the search button....................what have I forgotten to do please ?

isthatagnu.com/smf
SMF 2.0.12

Brettflan

Quote from: iain sherriff on February 12, 2013, 02:19:26 PM
hi.
Rebuilding the above site with Anecdota theme.
All installed well and works with defaul theme. I did a manual install on Anecdota as your search didnt work with that.
I now have the drop down menu but am missing the search button....................what have I forgotten to do please ?

isthatagnu.com/smf
You didn't provide a link to the theme in question, but after a quick search I see that the theme doesn't have a search button to begin with. It should work fine all the same, you just press Enter on your keyboard to submit the form.

haito

great mod :)

i have a question.

i have 3 board
index.php?board=56.0
index.php?board=57.0
index.php?board=58.0

how to add them into dropdown box as default dropdown?

thanks in advance:)
www.japanesia.co.id | Portal Berita & Komunitas Untuk Kamu yang Suka Jepang

Brettflan

Quote from: haito on March 19, 2013, 06:14:19 AM
great mod :)

i have a question.

i have 3 board
index.php?board=56.0
index.php?board=57.0
index.php?board=58.0

how to add them into dropdown box as default dropdown?

thanks in advance:)

You can add your own boards to the drop down by going into search configuration in the admin panel.

Skaty

How can i add this code without broke my theme ?



';

// Search Focus Dropdown
include_once($settings['default_theme_dir'] . '/SearchFocus.template.php');

echo '



</div>
<div id="search">
<form id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
<input class="search-input" type="text" name="search" value="', $txt['forum_search'], '" onfocus="this.value = \'\';" onblur="if(this.value==\'\') this.value=\'', $txt['forum_search'], '\';" />
<input class="search-button" type="submit" name="submit" value="" />';

Brettflan

Quote from: Skaty on March 27, 2013, 11:07:10 AM
How can i add this code without broke my theme ?



';

// Search Focus Dropdown
include_once($settings['default_theme_dir'] . '/SearchFocus.template.php');

echo '



</div>
<div id="search">
<form id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
<input class="search-input" type="text" name="search" value="', $txt['forum_search'], '" onfocus="this.value = \'\';" onblur="if(this.value==\'\') this.value=\'', $txt['forum_search'], '\';" />
<input class="search-button" type="submit" name="submit" value="" />';

For one thing you might add it after the submit button code on that theme; it looks like you have it added in before it, and that theme is clearly designed to have the look of the submit buttom blend into the right side of the search box. You can also of course use CSS to make the look of it match your theme better.

Advertisement: