News:

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

Main Menu

?action=search2;search=

Started by smartdeviceresource, January 03, 2010, 11:27:00 PM

Previous topic - Next topic

smartdeviceresource

#40
So if it isn't a stand alone script, if you combine your script with Joker's suggestion
<form action="', $scripturl, '?action=search2;search" type="text" size="20"> 
<input type="submit" value="Go" />
</form>

and place it in
the indextemplate
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;
<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'], '" />';
echo '</form>

after some thought, i've learned to be humble and leave the answering to the experts, until i too am an expert.  sorry to anyone who I've confused, with my answers

steve51184

#41
just tested that and again it doesn't work :(

also here's the code with proper line brakes and a few bit you missed out:

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

steve51184

just though i'd post what i have so far but again this is suffering from the = and ; not being parsed correctly (in the name= part of the 'replace' code)

in Themes\default\index.template.php

Code (find) Select
<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;
<input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" />
<input type="hidden" name="advanced" value="0" />';


Code (replace) Select
<form id="search_form" style="margin: 0;" action="', $scripturl, '" accept-charset="', $context['character_set'], '">
<input type="text" name="action=search2;search" value="" class="input_text" />&nbsp;
<input type="submit" value="', $txt['search'], '" class="button_submit" />';


now if you make the changes on your forum and do a search and look at the url you'll see how close we really are but again those damn = and ; are not being parsed correctly so we just need to figure that out

Joker™

but it's not even redirecting to search page , i'll try to work on this today
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

steve51184

Quote from: Joker™ on July 23, 2010, 12:57:28 AM
but it's not even redirecting to search page , i'll try to work on this today

yes it's not redirecting as the = and ; are not being parsed correctly but if you fix that it'll work perfectly

Klozi

Nice idea, I had no problem with using &search=value, like:
http://xxx/forum/index.php?action=search2&search=Mario

I guess, that's also possible to define the board id(s) and some other parameters based on the URL. :)

smartdeviceresource

Quote from: Klozi on July 23, 2010, 07:46:06 AM
Nice idea, I had no problem with using &search=value, like:
http://xxx/forum/index.php?action=search2&search=Mario

I guess, that's also possible to define the board id(s) and some other parameters based on the URL. :)
Yes but the point is for it to auto-do that when a search is done

* nergal  is getting sick of people saying to "just type the search=[term]."
yes I understand this works, I'm not about to fix a posters link everytime they want to link to a search on my site. . . I/ want for the poster to be able to COPY the URL from the Address bar and paste it into a reply. . . why is this so ununderstandable???!?!
after some thought, i've learned to be humble and leave the answering to the experts, until i too am an expert.  sorry to anyone who I've confused, with my answers

Joker™

Sources/search.php

very first commenting there is


/*   These functions are here for searching, and they are:

   void PlushSearch1()
      - shows the screen to search forum posts (action=search), and uses the
        simple version if the simpleSearch setting is enabled.
      - uses the main sub template of the Search template.
      - uses the Search language file.
      - requires the search_posts permission.
      - decodes and loads search parameters given in the URL (if any).
      - the form redirects to index.php?action=search2.

   void PlushSearch2()
      - checks user input and searches the messages table for messages
        matching the query.
      - requires the search_posts permission.
      - uses the results sub template of the Search template.
      - uses the Search language file.
      - stores the results into the search cache.
      - show the results of the search query.


i ruined my whole evening to find it out

"      - the form redirects to index.php?action=search2."


and im still empty hand , will try it again tomorrow.
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

Joker™

Got lucky today.I was reading developer's blog section here on smf today and found this piece of gold.

http://www.simplemachines.org/community/index.php?topic=205299.0

Let's make it now guys  8)
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

Joker™

So here we go ( i've not tested it completely , but gave me correct results )

Make a file search.php add this code in it

<?php
//Path to SSI.php
require(dirname(__FILE__) . '/SSI.php');
 
redirectexit('action=search2;search=' urlencode(stripslashes($_REQUEST['query'])));

?>


Save this file in your root directory

Now open themes\<your theme>\index.temaplte.php
Find:
action="', $scripturl, '?action=search2"

replace it with:
action="URL/search.php"
in URL put the path of above search file.For e.g
http://www.yoursite.com

Find:
<input type="text" name="search" value="" class="input_text" />&nbsp;

Replace it with:
<input type="text" name="query" value="" class="input_text" />&nbsp;

Done :).
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

Kill Em All

smartdeviceresource, did Joker's code work out well for you? If so, please feel free to mark this solved. :)


My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

Joker™

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

smartdeviceresource

I should be able to test joker's suggestion in the next few days, I had not had a chance yet (I also need to update to RC3 I know slackin' ;) ) the "more better" method linked above, I'm not sure I understand where the php (Brettflan's) would go nor where it would list the search value nor if drop focus mod is need ed for it.

Joker do you have your solution running on a public site, so maybe i can test it out. And of course thank you for your work on this topic thus far :)
after some thought, i've learned to be humble and leave the answering to the experts, until i too am an expert.  sorry to anyone who I've confused, with my answers

Joker™

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

smartdeviceresource

ok cool, then I'll try that one, as soon as I am able, thanks Joker. :)
after some thought, i've learned to be humble and leave the answering to the experts, until i too am an expert.  sorry to anyone who I've confused, with my answers

Joker™

Your welcome , for live result you can see my forum . If solution works for you don't forget to mark the topic solved :).
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

smartdeviceresource

Finally some time to try this after upgrading my local copy to rc3
so if forum (root directory) is saved in public_html/forum
and ssi.php is also in public_html/forum
and url for forum is "forum.smartdeviceresource.com"
I would create search.php in public_html/forum
and then write it as
<?php
//Path to SSI.php
require(SSI.php);
 
redirectexit('action=search2;search=' urlencode(stripslashes($_REQUEST['query'])));
?>


and then in my index.template use an absolute path of
action="forum.smartdeviceresource.com/search.php"

if so I'm testing that right now.  if it doesn't work I'll wait for jokers answer as to where I am going wrong

(Joker thank you for baring with me on this slow progress, I've had so much realworld stuff to do it was hard to get time for my forum, but with a local copy running I'm able to work on it better)
after some thought, i've learned to be humble and leave the answering to the experts, until i too am an expert.  sorry to anyone who I've confused, with my answers

Joker™

I think you should try this one

http://www.simplemachines.org/community/index.php?topic=402451.msg2800763#msg2800763

and then in my index.template use an absolute path of

action="forum.smartdeviceresource.com/search.php"
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

Aleksi "Lex" Kilpinen

Hi smartdeviceresource, any updates on this? Have you been able to sort this out already? :)
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

smartdeviceresource

Not really, I'm still trying to get Joker's PHP to work (also from the search page accessed from the main_menu).  Kinda stop playing with it for now, as I shift from RC2 to RC3 on my live and RC3 to RC4 on my Local, so I guess if needs be I can mark this as solved though I'd rather not.

*sigh* if only someone'd write a mod :P ;)
after some thought, i've learned to be humble and leave the answering to the experts, until i too am an expert.  sorry to anyone who I've confused, with my answers

Advertisement: