vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Adding Search Specific Forum Option (https://vborg.vbsupport.ru/showthread.php?t=295189)

Black Snow 02-16-2013 05:11 PM

Adding Search Specific Forum Option
 
Hi,

I didn't want to bump an old thread so I thought I would create a new one.

I am trying to create a search function, similar to the one used here, where a member can search specific forums. Just like this post, I have found the forumchoice[] is not working on 4.2.0.

I have titleonly working, as it will only show me threads that have the search term(s) in their title but it will not search in a specific forum.

Here is my current code.
Code:

                <form action="search.php?{vb:raw session.sessionurl}do=process" method="post" id="footer_search" class="footer_search">
                        <vb:comment><input type="hidden" name="s" value="{vb:raw session.sessionurl}" /></vb:comment>
                        <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
                        <input type="hidden" name="do" value="process" />

<input type="text" value="" name="query" class="textbox" tabindex="99" />
<select name="forumchoice[]">
            <option value="-1" selected="selected">All Forums</option>
            <option value="1">Forum 1</option>
            <option value="2">Forum 2</option>
            <option value="3">Forum 3</option>
            <option value="4">Forum 4</option>
            <option value="5">Forum 5</option>
          </select>
<select name="titleonly">
                <option value="0" selected="selected">All Posts</option>
                <option value="1" >Titles Only</option>
        </select>
                        <input type="image" class="searchbutton" src="{vb:stylevar imgdir_button}/search<vb:if condition="$stylevar['textdirection'] == 'rtl'">_rtl</vb:if>.png" name="submit" onclick="document.getElementById('navbar_search').submit;" tabindex="100"/>

                </form>

I would love some help if anyone has any suggestions.

Black Snow 02-17-2013 05:57 PM

Anyone help me with this?

Black Snow 02-18-2013 05:59 PM

Surely someone knows how I can fix this issue? I've been trying everything I can find on the forums to fix this problem.

Seems like nobody wants to help when it comes to making something that looks like or works like something here on vB.org.

Black Snow 03-05-2013 09:25 AM

Bah, guess I'll have to ask for help from somewhere else then.

Skyrider 07-28-2014 06:43 PM

Having the same issue :-\ been googling for hours.. Just can't get forumchoice[]=xx or forumchoice=xx to work. Search results works fine, it refuses to use the specified Forumchoice (forum section) though. It searches forum-wide instead.

kh99 07-28-2014 08:28 PM

Hmm...well, here's a list of what's being posted when I search from the search page using "single content type" of post and selecting some forums:

Code:

titleonly=0
searchuser=
starteronly=0
tag=
forumchoice%5B%5D=5
forumchoice%5B%5D=6
forumchoice%5B%5D=7
forumchoice%5B%5D=8
childforums=1
replyless=0
replylimit=
searchdate=0
beforeafter=after
sortby=dateline
order=descending
showposts=0
saveprefs=1
dosearch=Search+Now
searchthreadid=
s=
securitytoken=1406582637-cf67eb3a60e2ff5376b1527b3643f4ef0f2351cb
searchfromtype=vBForum%3APost
do=process
contenttypeid=1

So I'm guessing that the forumchoice[] fields are only used if some other option is set to a certain value (but sorry, I don't have time right now to figure out which one - maybe you can experiment).

Edit: glancing at the list, most of them are just options that I wouldn't think would affect whether or not forumchoice[] is used, so it seems like maybe you need do=process, contenttypeid=1, and/or dosearch=Search+Now.

tbworld 07-28-2014 09:06 PM

Attach a functional page of code that I can test as a PHP file (so I do not have to create it myself) and I will be glad to take a look at it. :)

Skyrider 07-29-2014 09:44 AM

Quote:

Originally Posted by tbworld (Post 2508741)
Attach a functional page of code that I can test as a PHP file (so I do not have to create it myself) and I will be glad to take a look at it. :)

I'm using a search code in a template though, for example:

Quote:

<a href="/search.php?do=finduser&userid={vb:raw post.userid}&contenttype=vBForum_Threads&showposts =0&forumchoice=35&forumchoice[]=35">test</a>
Using both forumchoice / forumchoice[] to make sure it "works", though it doesn't. Even when I use them separately.

kh99 07-29-2014 10:16 AM

It does seem like forumchoice[] should work. "include" works, if what you're doing is coding a link like in your example, but it's a comma-separated list of ids so it wouldn't work with an option list (like the OP was asking about).

Skyrider 07-29-2014 10:22 AM

So you are saying I can't get a section-search to work through a text link url search?


All times are GMT. The time now is 10:27 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.03390 seconds
  • Memory Usage 1,745KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete