![]() |
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?
|
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. :) |
I'd love to see some example code!
|
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> Code:
$relative_script_path = 'full/path/to/phpdig'; |
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.
|
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:
|
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.
|
I must apologize for the problems you had with my code. I guess I didn't take my testing far enough with it. :o Sounds like I was making this more complicated than it needed to be anyway.
I think this is probably what you're looking for: PHP Code:
|
All times are GMT -8. The time now is 07:26 PM. |
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.