News:

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

Main Menu

Search Focus Dropdown

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

Previous topic - Next topic

Bugo

Updated russian translation

Joker™

Quote from: Brettflan on July 09, 2010, 12:25:20 PM
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.



awesome , thanks alot :D
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

~DS~

"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

searchgr


Eclipse16V

Here the new German:

$txt['search_focus_topic'] = 'Dieses Thema';
$txt['search_focus_board'] = 'Dieses Forum';
$txt['search_focus_all'] = 'Gesamtes Forum';
$txt['search_focus_google'] = 'Google';
$txt['search_focus_enable_google'] = 'Erlaube die Google Suche als Zusätzliche Opdtion im Dropdown Menü.';
I worked with:
SMF 2 in German

Shop:
SID Giessen

Eclipse16V

Is it possible which one with googles for search googles AdSense code use can? What there do I have to change? I think times in the Search.php or?
I worked with:
SMF 2 in German

Shop:
SID Giessen

Brettflan

Quote from: Eclipse16V on July 13, 2010, 04:24:47 PM
Is it possible which one with googles for search googles AdSense code use can? What there do I have to change? I think times in the Search.php or?

Yeah, you can probably modify this line added to Search.php as needed:
header( 'Location: http://www.google.com/search?q=' . urlencode($_REQUEST['search']) . '&sitesearch=' . $site_domain );

I don't use AdSense so I'm not sure what would actually be involved.

Churada

I see from the first page that this doesn't show up in Simple Portal, as is indeed the case on my board (2 RC3).
Is there any way to enable it on a board that uses Simple Portal?

Brettflan

AFAIK, Simple Portal completely removes the search form and just leaves the Search page instead. If you knew what you were doing, you might be able to edit the theme to add that search form back; then again, there's probably some reason the Simple Portal team removed it. I'm not sure what that reason might be, since I don't (currently) use Simple Portal.

Joker™

Sorry to disturb you again , i was trying to make that how search url appear as

yourforumlink.com/?action=search2;search=your search item name


achieved it on simple search here
http://www.simplemachines.org/community/index.php?topic=357785.msg2739675#msg2739675

Just finding it difficult how to achieve it with your mod.If you have time please look at this , as i think it's quite useful feature .
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

Quote from: Joker™ on August 11, 2010, 07:42:57 AM
Sorry to disturb you again , i was trying to make that how search url appear as

yourforumlink.com/?action=search2;search=your search item name


achieved it on simple search here
http://www.simplemachines.org/community/index.php?topic=357785.msg2739675#msg2739675

Just finding it difficult how to achieve it with your mod.If you have time please look at this , as i think it's quite useful feature .

The way you're doing it, it appears that your search.php is discarding all other form data besides the search terms (originally "search", changed to "query" for some reason in your version). Have it pass on the rest of the data and it should work fine.

Joker™

Quote from: Brettflan on August 11, 2010, 08:21:13 AM
The way you're doing it, it appears that your search.php is discarding all other form data besides the search terms (originally "search", changed to "query" for some reason in your version). Have it pass on the rest of the data and it should work fine.
when i search with option "this board" it is searching the whole site , and not the specified code , that happens with posts too.
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

Quote from: Joker™ on August 11, 2010, 08:36:19 AM
Quote from: Brettflan on August 11, 2010, 08:21:13 AM
The way you're doing it, it appears that your search.php is discarding all other form data besides the search terms (originally "search", changed to "query" for some reason in your version). Have it pass on the rest of the data and it should work fine.
when i search with option "this board" it is searching the whole site , and not the specified code , that happens with posts too.

Exactly. It does that because you're discarding all of that other form data, as I said.

Joker™

Quote from: Brettflan on August 11, 2010, 08:21:13 AM
The way you're doing it, it appears that your search.php is discarding all other form data besides the search terms (originally "search", changed to "query" for some reason in your version).
if that change is not made then search doesn't occur.

QuoteHave it pass on the rest of the data and it should work fine.
Can you put some more light on it ?
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

When you submit an HTML form, valid data from all of the form elements is passed on. If the form is using GET (method="get"), all of that data is passed on visibly in the URL, which is of course what you want in this case. If the form is using POST (method="post"), all of the form data is passed on in the HTTP request sent to the server instead of being tacked onto the URL. If you want to monitor POST data, there are various tools you can use. I use the Firefox extension "Live HTTP Headers", though the Firebug extension also allows that. I believe the "Web Developer" extension also allows it, but I've never tried using it for that.
As for what the exact data is, simply look within the <form> for <input>, <select>, <checkbox>, and so forth.
Basically, once you've figured out all of the various data that can potentially be submitted (by monitoring the HTTP headers for all possible submissions, checking over the contents of the form itself, or a combination of the two), you'll need to piece together a GET version of the URL.

Actually though, I don't suppose you really need to know all of the data, if you're smart about it in PHP...
Here, a quick example based on your code posted in the other thread, something like this (you'll need to revert your name="search"->name="query" change so that text element is back to the original name "search"):
<?php
//Path to SSI.php
require(dirname(__FILE__) . '/SSI.php');

$redir 'action=search2';

foreach (
$_POST as $var => $val)
$redir .= ';' urlencode(stripslashes($var)) . '=' urlencode(stripslashes($val));

redirectexit($redir);
?>


That should work for what you're after, though I haven't tested it.

Joker™

Quote from: Brettflan on August 13, 2010, 02:38:05 AM
When you submit an HTML form, valid data from all of the form elements is passed on. If the form is using GET (method="get"), all of that data is passed on visibly in the URL, which is of course what you want in this case. If the form is using POST (method="post"), all of the form data is passed on in the HTTP request sent to the server instead of being tacked onto the URL. If you want to monitor POST data, there are various tools you can use. I use the Firefox extension "Live HTTP Headers", though the Firebug extension also allows that. I believe the "Web Developer" extension also allows it, but I've never tried using it for that.
As for what the exact data is, simply look within the <form> for <input>, <select>, <checkbox>, and so forth.
Basically, once you've figured out all of the various data that can potentially be submitted (by monitoring the HTTP headers for all possible submissions, checking over the contents of the form itself, or a combination of the two), you'll need to piece together a GET version of the URL.
That was really helpful .

I tried the code and changed the name="query" -> name="search" , but still it seems to search whole site and not a specific board or post.
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

Can you provide a non-working link which it outputs, for reference?

Joker™

In my test site, i went in Board "A" , and searched for -> Test

Same name post is in Board "B" also

the search output url is

http://localhost/rc3/index.php?action=search2;search=test;search_focus=board;submit=Search;advanced=0;brd=

Also in result both test posts of Board "A" and "B" were shown , and i just made search for Board "A" post.
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

Aportadordelmix

db_setting.php?

installation manual


themes/default/db_setting.php??

sources/db_setting.php?

Brettflan

Quote from: Joker™ on August 13, 2010, 03:28:36 AM
In my test site, i went in Board "A" , and searched for -> Test

Same name post is in Board "B" also

the search output url is

http://localhost/rc3/index.php?action=search2;search=test;search_focus=board;submit=Search;advanced=0;brd=

Also in result both test posts of Board "A" and "B" were shown , and i just made search for Board "A" post.

OK, I think the "brd" value is being parsed out as an array and getting lost. Try this then:

<?php
//Path to SSI.php
require(dirname(__FILE__) . '/SSI.php');

$redir 'action=search2';

foreach (
$_POST as $var => $val)
{
if( is_array($val) )
foreach ($val as $vala => $valb)
$redir .= ';' urlencode(stripslashes($var)) . '[' urlencode(stripslashes($vala)) . ']=' urlencode(stripslashes($valb));
else
$redir .= ';' urlencode(stripslashes($var)) . '=' urlencode(stripslashes($val));
}

redirectexit($redir);

?>



Quote from: Aportadordelmix on August 13, 2010, 03:56:21 AM
db_setting.php?
installation manual

themes/default/db_setting.php??

sources/db_setting.php?

I'm going to go out on a limb and assume you're asking what to do with db_setting.php when manually installing... if that's what you're asking, it should be extracted to your root SMF directory and run once from there (http://www.yourforum.com/forum_path/db_setting.php), then deleted. It adds the default value for the "enable Google choice or not" admin option.

Advertisement: