vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How to create a "search" link with "search titles only" by default (https://vborg.vbsupport.ru/showthread.php?t=107856)

stark427 02-13-2006 10:26 AM

How to create a "search" link with "search titles only" by default
 
Hello all.

I have a reviews page which reflects all the CD reviews that have been made at my forum.

I want to make a search link (or button - I don't care) that will lead directly to the search.php *but* it will have as default the "search titles only" option.

this way my users will be able to search - the - reviews forum - by - artist (where artist = the title of the topics/reviews).

could anyone tell me how I could do that ?

thanx in advance

Marco van Herwaarden 02-13-2006 10:57 AM

Try adding titleonly=1 to the url.

stark427 02-13-2006 11:20 AM

Quote:

Originally Posted by MarcoH64
Try adding titleonly=1 to the url.

It works :)

Thanx

http://www.electrowave.gr/forum/search.php?titleonly=1

Now could we also make it so that ...

1) it will only have one specific (by ID ?) forum selected to search in (my reviews forum)

2) the search options will not be shown

Marco van Herwaarden 02-13-2006 11:28 AM

http://www.electrowave.gr/forum/search.php?titleonly=1&forumid=<forumid>

2. I don't think so, unless you create your own Search box (like the standard quicksearch).

stark427 02-13-2006 11:33 AM

thank YOU :)

Now I'll go find out how to create a search form and when I create it I will put that link down...

Marco van Herwaarden 02-13-2006 11:47 AM

Quote:

Originally Posted by stark427
thank YOU :)

Now I'll go find out how to create a search form and when I create it I will put that link down...

Just copy the code for the standard Quick Search, and adopt to your needs.

stark427 02-13-2006 11:55 AM

Quote:

Originally Posted by MarcoH64
Just copy the code for the standard Quick Search, and adopt to your needs.

first of all thanx for the support

Let me make clear that I want to put the search form on a page outside the forum - actually on a VBadvanced page...

here is the code I have put:

Code:


<smallfont><form action="http://www.electrowave.gr/forum/search.php?forumid=29" method="post">
&nbsp;<input type="hidden" name="s" value="$session[sessionhash]">
<input type="hidden" name="forumchoice" value="- 1" /><input type="hidden" name="searchin" value="subject" /><input type="hidden" name="searchdate" value="-1" /><input type="hidden" name="action" value="simplesearch" /><input type="hidden" name="booleanand" value="yes" />
<input class="search" onFocus="this.value='';" type="text" name="query" value="search..." size="15" maxlength="150"/>

<input type="hidden" name="action" value="simplesearch">
</form></smallfont>

but it has one problem

instead of searching the forum
it just redirects to the Search.php with the keyword inserted in the search field...


which is the standard quick search code?

Marco van Herwaarden 02-13-2006 02:18 PM

This the standard vB code for the quick search:
HTML Code:

                        <form action="search.php" method="post">
                                <input type="hidden" name="do" value="process" />
                                <input type="hidden" name="showposts" value="0" />
                                <input type="hidden" name="quicksearch" value="1" />
                                <input type="hidden" name="s" value="$session[sessionhash]" />
                                <input type="text" class="bginput" name="query" size="20" />&nbsp;$gobutton<br />
                        </form>

Just change it with the added forumid.

PS In your example you seem to be missing the 'do', also don't use full url's, better relative file ie "forum/search.php........"

stark427 02-13-2006 02:52 PM

Quote:

Originally Posted by MarcoH64
This the standard vB code for the quick search:
HTML Code:

                        <form action="search.php" method="post">
                                <input type="hidden" name="do" value="process" />
                                <input type="hidden" name="showposts" value="0" />
                                <input type="hidden" name="quicksearch" value="1" />
                                <input type="hidden" name="s" value="$session[sessionhash]" />
                                <input type="text" class="bginput" name="query" size="20" />&nbsp;$gobutton<br />
                        </form>

Just change it with the added forumid.

PS In your example you seem to be missing the 'do', also don't use full url's, better relative file ie "forum/search.php........"


Ok thanx

here is what I have put :

Code:

<form action="forum/search.php?forumid=29" method="post">
                                <input type="hidden" name="do" value="process" />
                                <input type="hidden" name="showposts" value="0" />
                                <input type="hidden" name="quicksearch" value="1" />
                                <input type="hidden" name="s" value="$session[sessionhash]" />
                                <input type="text" class="bginput" name="query" size="20" />&nbsp;$gobutton<br />
</form>

I have also tried by putting:

Code:

<form action="forum/search.php?include=29" method="post">...

it works but it searches the whole forum and not only the forum with ID=29 :disappointed:

Marco van Herwaarden 02-13-2006 03:24 PM

Don't use the forumid in the filename. Insert the followingline instead:
HTML Code:

                                <input type="hidden" name="forumid" value="29" />

stark427 02-13-2006 03:36 PM

Quote:

Originally Posted by MarcoH64
Don't use the forumid in the filename. Insert the followingline instead:
HTML Code:

                                <input type="hidden" name="forumid" value="29" />

Just tried.

Code:


<form action="forum/search.php" method="post">
        <input type="hidden" name="forumid" value="29" />
        <input type="hidden" name="do" value="process" />
        <input type="hidden" name="showposts" value="0" />
        <input type="hidden" name="quicksearch" value="1" />
        <input type="hidden" name="s" value="$session[sessionhash]" />
        <input type="text" class="bginput" name="query" size="20"/>&nbsp;$gobutton<br />
</form>

still searches the whole forum.

With a little help from Brian over at VBadvanced.com I found that this could work by adding this line :

Code:

<input type="hidden" name="forumchoice[]" value="your_forum_id_here" />
so the final code I have put (to search by titles ONLY + search only a specific forum) is this :

Code:

<form action="forum/search.php?titleonly=1" method="post">
        <input type="hidden" name="forumchoice[]" value="29" />
        <input type="hidden" name="do" value="process" />
        <input type="hidden" name="showposts" value="0" />
        <input type="hidden" name="quicksearch" value="1" />
        <input type="hidden" name="s" value="$session[sessionhash]" />
        <input type="text" class="bginput" name="query" size="20"/>&nbsp;$gobutton<br />
</form>


Now one last modification I want to make is to remove the "GO" button. I want it to have only the search field and the users to insert the keyword and press enter...

I was thinking of just removing this code

Code:

&nbsp;$gobutton
would this cause any problems - (maybe to specific browsers)?


All times are GMT. The time now is 07:14 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01570 seconds
  • Memory Usage 1,762KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (4)bbcode_html_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (11)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete