• Welcome to Simple Machines Community Forum. Please login or sign up.
December 04, 2021, 12:19:56 PM

News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord


Search Focus Dropdown

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

Previous topic - Next topic

@rjen

That's a fairly simple thing to do, I am sure some one will help you if you attach the file. I would...
Running SMF 2.0 with Tinyportal 2.1.0 at www.fjr-club.nl
Testing SMF 2.1 with Tinyportal 2.1.0 at test2.fjr-club.nl

Dwev

Thanks for the generous offer, I attached our index.template.php

@rjen

Quote from: Dwev on December 25, 2017, 08:05:00 AM
Thanks for the generous offer, I attached our index.template.php

Mmm, I had a quick look, expecting to find some sort of reference to the search box in this remplate, but it does not seem to be there..

Two questions:
1. does your theme actually have the search box in the header?
2. can you provide a link to the forum to check?
Running SMF 2.0 with Tinyportal 2.1.0 at www.fjr-club.nl
Testing SMF 2.1 with Tinyportal 2.1.0 at test2.fjr-club.nl

skb

To open Google Search results in a new tab, where can I add - target="_blank"
if ($s_focus == 'google')
header( 'Location: http://www.google.com/search?q=' . urlencode($_REQUEST['search']) . '&sitesearch=' . $site_domain );

SMF 2.1 RC4 (default theme) / TP 2.1.0

Sir Osis of Liver

"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

Dwev

Quote from: @rjen on December 25, 2017, 12:48:17 PM
Two questions:
1. does your theme actually have the search box in the header?
2. can you provide a link to the forum to check?

1. No, our theme does't have this, But I had one activated through SimplePortal, I just added a second one (one on the header block, one in the right block).
2. Test-site can be found here: https://www.applezone.nl

@rjen

Quote from: Dwev on December 27, 2017, 10:22:54 AM
Quote from: @rjen on December 25, 2017, 12:48:17 PM
Two questions:
1. does your theme actually have the search box in the header?
2. can you provide a link to the forum to check?

1. No, our theme does't have this, But I had one activated through SimplePortal, I just added a second one (one on the header block, one in the right block).
2. Test-site can be found here: https://www.applezone.nl

That explains the problem: the mod will try to enhance the existing function. If the function is not there it cannot be enhanced: you will have to create it first in the theme.

As far as I can see in the index.template.php a designer has stripped that part out of the original template file (which is a copy from curve as far as I can see)  when he stripped out all other items , such as the login form, newsfader, the header toggle etcetera

It will need to be put back in for this mod to work...

This guy...
Quote/*   MacFreak is a work of Joost Kolkman - mediabouwers.nl. For more information please visit
   http://mediabouwers.nl/
   MacFreak was developed by Joost Kolkman.
*/

The code that needs to be put back in (somewhere around line: 284) is this:


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

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

echo '
<input type="submit" name="submit" value="', $txt['search'], '" 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'], '" />';





Running SMF 2.0 with Tinyportal 2.1.0 at www.fjr-club.nl
Testing SMF 2.1 with Tinyportal 2.1.0 at test2.fjr-club.nl

Dwev

The theme that he built was based on Bootstrap, I guess this got lost in the process.

I just added the code in the index.template.php of the theme, and turned off the search options from SimplePortal.

And it worked!
I now have a Search field, and Search Focus Dropdown did indeed install without a problem!

One more question, the Search field is all the way down at the bottom (in the footer I guess).
I suppose that this has to do where it was placed in the code?

If you want to have a look, the URL hasn't changed.

@rjen

Yes,

if you want it in the header, try moving the code into a div in the header section
You may want to try in the  '<div class="userarea navbar-right">'
Line 212 in the template.

Getting it right takes some experimentation using the correct div and styles, depending on where you exactly want it to show up...
Running SMF 2.0 with Tinyportal 2.1.0 at www.fjr-club.nl
Testing SMF 2.1 with Tinyportal 2.1.0 at test2.fjr-club.nl

a10

This very useful mod doing fine in 2.0.17 \ php 7.2 & 7.3

Looking into the future :O) testing php 7.4, search works but with following:

hps://ww.asdfgh/forum/index.php?action=admin;area=logs;sa=errorlog;desc
8: Trying to access array offset on value of type null
File: /customers/asdfgh/httpd.www/forum/Sources/ManageErrors.php
Line: 129

hps://ww.asdfgh/forum/index.php?action=search2
8: Trying to access array offset on value of type null
File: /customers/asdfgh/httpd.www/forum/Themes/default/languages/SearchFocus.english.php (results sub template - eval?)
Line: 316
2.0.18, php 7.4.25, MariaDB 10.3.30. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

a10

^^^ ref post above. Using smf 2.0.18 all looks well, no errors showing up with php 7.4.15
2.0.18, php 7.4.25, MariaDB 10.3.30. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

shawnb61

I find this mod quite helpful.  And yes, it runs perfectly on the latest smf/php versions.

It'd be nice to see a 2.1 version!   :)
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Advertisement: