![]() |
|
![]() |
#1 |
Green Mole
Join Date: Apr 2004
Posts: 9
|
Adding search box to every page
I'd like to add a simple search box to every page of my site...it would just have a search box to type in your query and a "go" button......how can I setup the simple search box to pass the query to the search.php file using the default options for results and operator?
|
![]() |
![]() |
![]() |
#2 |
Purple Mole
Join Date: Jan 2004
Posts: 694
|
The simplest way to do that is to have the search box code in an include file as part of either the header or footer for each page on your site. It's a good idea to have header and footer includes anyway, as it becomes much easier to change the look and feel of your site, should you ever decide to do that.
If you need a specific example of how to do that, I'd be glad to post some code for you. ![]() |
![]() |
![]() |
![]() |
#3 |
Green Mole
Join Date: Apr 2004
Posts: 9
|
I'd love to see some example code!
|
![]() |
![]() |
![]() |
#4 |
Purple Mole
Join Date: Jan 2004
Posts: 694
|
OK, this was a little more complicated than I originally thought it would be, but here goes.
Find the following code in config.php: PHP Code:
PHP Code:
PHP Code:
PHP Code:
Code:
<table> <tr> <td> <phpdig:form_title/> </td> </tr> <tr> <td> <phpdig:form_field/> <phpdig:form_button/> <phpdig:form_select/> </td> </tr> <tr> <td> <phpdig:form_radio/> </td> </tr> </table> Code:
$relative_script_path = 'full/path/to/phpdig'; include "$relative_script_path/includes/config.php"; include "$relative_script_path/admin/debug_functions.php"; include "$relative_script_path/libs/search_function.php"; // extract vars extract(phpdigHttpVars( array('query_string'=>'string', 'refine'=>'integer', 'refine_url'=>'string', 'site'=>'integer', 'limite'=>'integer', 'option'=>'string', 'lim_start'=>'integer', 'browse'=>'integer', 'path'=>'string' ) )); //template file and style $template = "$relative_script_path/templates/searchbox.php"; phpdigSearch($id_connect, $query_string, $option, $refine, $refine_url, $lim_start, $limite, $browse, $site, $path, $relative_script_path, $template); ![]() Last edited by vinyl-junkie; 04-17-2004 at 10:12 PM. |
![]() |
![]() |
![]() |
#5 |
Green Mole
Join Date: Apr 2004
Posts: 9
|
Thanks for that code vinyl-junkie! I can't make those modifications right now but I'll let you know how it turns out when I have the chance to.
|
![]() |
![]() |
![]() |
#6 |
Purple Mole
Join Date: Jan 2004
Posts: 694
|
You're welcome!
![]() I just noticed an error in the code that I posted. In my previous post, I said to find the following code in config.php: PHP Code:
PHP Code:
![]() |
![]() |
![]() |
![]() |
#7 |
Green Mole
Join Date: Apr 2004
Posts: 9
|
I just tried it out and the only problem I'm encountering is the fact that clicking the Go button does nothing when you add the searchbox to other pages. The search.php still works for searching though. Also, in the searchbox.php file, are you sure it will work if I don't add the form_select and form_radio? I'd like the searchbox on other pages to have only the searchbox and the go button, but when you go to the search.php page you get all the options.
|
![]() |
![]() |
![]() |
#8 |
Purple Mole
Join Date: Jan 2004
Posts: 694
|
I must apologize for the problems you had with my code. I guess I didn't take my testing far enough with it.
![]() I think this is probably what you're looking for: PHP Code:
![]() |
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Search box on every page? | chrisdgreen | How-to Forum | 3 | 07-29-2005 09:27 AM |
Blank page after adding code mods | Brewer | External Binaries | 1 | 07-06-2005 12:34 PM |
Adding a thumbnail to each page...help? | huge_nerd | How-to Forum | 1 | 11-16-2004 09:54 AM |
Adding search box to every page (cont'd) | rogerh | How-to Forum | 1 | 10-11-2004 11:08 AM |
Search box on html page | rafarspd | How-to Forum | 4 | 12-04-2003 06:37 AM |