The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
How to implement "search" on a custom page?
Hii.. just check out this custom vb page.
As you can see, the page lists websites with some details on the left side. There is a Category field displayed too. All I want is to enable search within that page by Category that looks something like this where Add On Releases listbox can be replaced with my Categories list. Need help on how to do so. Thank You |
#2
|
||||
|
||||
Just copy the form from the regular quick search. make sure all those variables are there and then add your own (for categories).
|
#3
|
||||
|
||||
well.. sry but I have no idea how to do this.. can you please explain me in more detail.
This is the quick search form i got in the navbar:- HTML Code:
<!-- header quick search form --> <div class="vbmenu_popup" id="navbar_search_menu" style="display:none" align="$stylevar[left]"> <table cellpadding="4" cellspacing="1" border="0"> <tr> <td class="thead">$vbphrase[search_forums]</td> </tr> <tr> <td class="vbmenu_option" title="nohilite"> <form action="search.php?do=process" method="post"> <input type="hidden" name="do" value="process" /> <input type="hidden" name="quicksearch" value="1" /> <input type="hidden" name="childforums" value="1" /> <input type="hidden" name="exactname" value="1" /> <input type="hidden" name="s" value="$session[sessionhash]" /> <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" /> <div><input type="text" class="bginput" name="query" size="25" tabindex="1001" /><input type="submit" class="button" value="$vbphrase[go]" tabindex="1004" /></div> <div style="margin-top:$stylevar[cellpadding]px"> <label for="rb_nb_sp0"><input type="radio" name="showposts" value="0" id="rb_nb_sp0" tabindex="1002" checked="checked" />$vbphrase[show_threads]</label> <label for="rb_nb_sp1"><input type="radio" name="showposts" value="1" id="rb_nb_sp1" tabindex="1003" />$vbphrase[show_posts]</label> </div> </form> </td> </tr> <if condition="$vboptions[threadtagging]"> <tr> <td class="vbmenu_option"><a href="tags.php$session[sessionurl_q]" rel="nofollow">$vbphrase[tag_search]</a></td> </tr> </if> <tr> <td class="vbmenu_option"><a href="search.php$session[sessionurl_q]" accesskey="4" rel="nofollow">$vbphrase[advanced_search]</a></td> </tr> $template_hook[navbar_search_menu] </table> </div> <!-- / header quick search form --> --------------- Added [DATE]1217623494[/DATE] at [TIME]1217623494[/TIME] --------------- well this code gives me the correct search layout that I want, but what to do next ? HTML Code:
<form action="forumdisplay.php" method="get"> <input type="hidden" name="s" value="$session[sessionhash]" /> <input type="hidden" name="f" value="$forumid" /> <input type="hidden" name="page" value="$pagenumber" /> <input type="hidden" name="pp" value="$perpage" /> <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"> <tr> <td class="thead"><phrase 1="$limitlower" 2="$limitupper" 3="$totalthreads">$vbphrase[showing_threads_x_to_y_of_z]</phrase></td> </tr> <tr valign="top"> <td class="alt1"> <table cellpadding="3" cellspacing="0" border="0" align="center"> <tr> <td><select name="sort" id="sel_sort"> <option value="category" $sort[title]>Category</option> <option value="reviews" $sort[postusername]>Reviews</option> </select></td> <td><select name="order" id="sel_order"> <option value="asc" $order[asc]>Ascending</option> <option value="desc" $order[desc]>Descending</option> </select></td> <td class="smallfont" align="$stylevar[right]" style="padding-top:$stylevar[cellpadding]px"> <input type="submit" class="button" value="Show Websites" /> </td> </tr> </table> </td> </tr> </table> </form> <form action="inlinemod.php?forumid=$forumid" method="post" id="inlinemodform"> <input type="hidden" name="url" value="$url" /> <input type="hidden" name="s" value="$session[sessionhash]" /> <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" /> <input type="hidden" name="forumid" value="$forumid" /> <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center" id="threadslist"> <tbody> </tr> </tbody> </form> </table> |
#4
|
||||
|
||||
You want to show all the categories? Just copy the code that makes the Forum Jump menu on the bottom of the left side of the page. Put that code in your page and make it spit out the drop-down like it does for the jump menu.
|
#5
|
||||
|
||||
1. Can you please explain me programmatically ?
2. I had already done what you had said, copied the code to my page template->the form shows->made a drop down of that->now what ? 3. Can this be done with the original vbulletin SEARCH.PHP file in form's action ? If yes, how will I make it retrieve search data from my custom tables that my page is storing data in. See the demo of what i am doing here. Thank you |
#6
|
||||
|
||||
You added the code from the search field into a new form after the form you had there (the one with the drop-down and Show Websites). You kinda have the html all messed up around there. You only need one form - you have two (one that you can't even access). You need to add those "type=hidden" inputs to under your other hidden inputs. You also need to give your new form a unique name..... I have a search form on my torrents page and I have it set to only search thread titles in two forums. This is some of what I added in my template:
HTML Code:
<form action="search.php" method="post" name="vbform"> <input type="hidden" name="s" value="$session[sessionhash]" /> <input type="hidden" name="do" value="process" /> <input type="hidden" name="titleonly" value="1" /> <input type="hidden" name="showposts" value="0"> <input type="hidden" name="sortby" value="lastpost"> <input type="hidden" name="order" value="descending"> <input type="hidden" name="s" value=""> <input type="hidden" name="forumchoice[]" value="12"> <input type="hidden" name="forumchoice[]" value="13"> All my input fields that they may select </form> |
#7
|
||||
|
||||
alright.. I have edited it now.. plz see it
So, here's my form now ! HTML Code:
<!-- Modified Website Search Layout --> <form action="search.php" method="post" name="linksearch"> <input type="hidden" name="s" value="$session[sessionhash]" /> <input type="hidden" name="do" value="process" /> <input type="hidden" name="titleonly" value="1" /> <input type="hidden" name="showposts" value="0"> <input type="hidden" name="sortby" value="lastpost"> <input type="hidden" name="order" value="descending"> <input type="hidden" name="s" value=""> <input type="hidden" name="forumchoice[]" value="12"> <input type="hidden" name="forumchoice[]" value="13"> <input type="hidden" name="page" value="$pagenumber" /> <input type="hidden" name="pp" value="$perpage" /> <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" /> <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"> <tr> <td class="thead"><phrase 1="$limitlower" 2="$limitupper" 3="$totalthreads">$vbphrase[showing_threads_x_to_y_of_z]</phrase></td> </tr> <tr valign="top"> <td class="alt1"> <table cellpadding="3" cellspacing="0" border="0" align="center"> <tr> <td><select name="category" id="category"> <option value="0">Category</option> <option value="1">Arts and Literature</option> <option value="2">Blogs and Personal</option> </select></td> <td><select name="order" id="sel_order"> <option value="asc" $order[asc]>Ascending</option> <option value="desc" $order[desc]>Descending</option> </select></td> <td class="smallfont" align="$stylevar[right]" style="padding-top:$stylevar[cellpadding]px"> <input type="submit" class="button" value="Show Websites" /> </td> </tr> </table> </td> </tr> </table> </form> <!-- /Modified Website Search Layout --> Thanks |
#8
|
||||
|
||||
I would copy the search.php page, call it something else (sorry, I thought you want to use the vb search) and change the queries in there to go to your table. You can then probably get rid of some of the hidden fields (the two "forumchoice[]" ones in mine were to just search those two forumids on my page).
|
#9
|
||||
|
||||
isn't there any other way ? SEARCH.PHP is a 121kb file, there's so much in it that is not at all required.
Can't I keep it simple something like links.php?do=search , it would be more efficient i think. thanks |
#10
|
||||
|
||||
Actually, I realized that you can still use the search.php page. Just set up another do action for your form - like do=links or do=directory. That should work out fine.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|