Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-01-2008, 06:00 PM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Attached Images
File Type: jpg untitled.jpg (8.7 KB, 0 views)
Reply With Quote
  #2  
Old 08-01-2008, 06:12 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just copy the form from the regular quick search. make sure all those variables are there and then add your own (for categories).
Reply With Quote
  #3  
Old 08-01-2008, 07:01 PM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
		&nbsp;
		<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 -->
I put this in my template, it displays a search form, what next ? how to make it search from websites table by category ?

--------------- 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>
Reply With Quote
  #4  
Old 08-01-2008, 08:17 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 08-01-2008, 08:44 PM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #6  
Old 08-01-2008, 09:21 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
So, you can see that I do use the search.php action and I give it a unique name. I also fill in a ton of hidden fields that the search form will need. Then, all my input fields use the correct name to correspond to what the search.php file wants.
Reply With Quote
  #7  
Old 08-01-2008, 09:52 PM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 -->
Now, what to do next ? How would search.php would make a search in my custom table ?
Thanks
Reply With Quote
  #8  
Old 08-01-2008, 11:37 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #9  
Old 08-02-2008, 12:10 AM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #10  
Old 08-02-2008, 12:16 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:42 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.06615 seconds
  • Memory Usage 2,322KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete