PDA

View Full Version : Simple Search Bar?


Greeksgal
11-24-2008, 12:24 PM
I'd like to place a simple search bar at the top centre of one of my forums but not on my front page (i.e navbar or header) actually in one of the forums under the catagories. I've tried the code below which works but it allows search to search the entire forum, I only want it to search the forum it's placed in...any ideas?

<if condition="$forumid == 25">
<!-- Search Box -->
<td valign="center" class="alt1"> <div style="white-space:nowrap">
<form action="http://www.**************.com/search.php" method="post">
<input type="hidden" name="s" value="" />
<input type="hidden" name="do" value="process" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="hidden" name="showposts" value="0" />
<input type="hidden" name="quicksearch" value="1" />
<input type="text" style="width:100px;" class="bginput" name="query"/>
<input style="font: bold 10px Arial" type="submit" class="button" value="Search" /></form> </if>
<a style="text-decoration:none" href="search.php" accesskey="4" rel="nofollow" id="navbar_search"

class=""></a>&nbsp;
</div></td>
<!-- /Search Box -->

Lynne
11-24-2008, 02:30 PM
Add in a line like this:
<input type="hidden" name="forumchoice[]" value="xx">

And what is the purpose of this line?
<a style="text-decoration:none" href="search.php" accesskey="4" rel="nofollow" id="navbar_search"

class=""></a>

Greeksgal
11-24-2008, 09:07 PM
I've no idea to be honest, I just copied the code from a mod, am I free to take that bit out?

Thanks for the extra line :D

Also, although the code says "align center" when I add the code to my forumdisplay template the search box is way off to the left, any ideas how to get it in the middle?

Thanks :)

Lynne
11-24-2008, 09:36 PM
The align center is for that one table cell which could be the left table cell so it's centered in the left table cell which is to the... left.

Greeksgal
11-25-2008, 12:13 PM
So how would I use the centre table cell? Sorry to be a pain, I know nothing about coding unfortunately. Thanks x

Lynne
11-25-2008, 01:58 PM
And I know nothing about your site layout, so I can't answer that. But, you would basically take the whole <form> and put it in the table cell you want. You basically added a whole <td> for your search bar and if you copy/pasted that, then you may be causing problems in the table with that. Usually you can't just add a new column without also adding a column to the other rows or you will have improper html on your page and cause weird things to happen.

behcet
12-01-2008, 03:45 PM
hello, i have a trouble. this code search any word but when we the word has extensions, the code cannot find the word(s) and users do not know this. for example, when i wrote "windows", code finds the "windows" topics. but when i wrote "windowsxp" the code finds nothing. how must i modify the code? thnx

Lynne
12-01-2008, 03:54 PM
If there are no posts with exactly "windowsxp" then it will return nothing. I would have thought you meant "windows xp" though (with the space). That won't work unless you allow 2 character searches. If you are using fulltext search then that means recompiling mysql to allow 2 characters searches.

behcet
12-01-2008, 04:05 PM
sorry but i dont mean that. i need to give an other example. when i wrote the search bar "thunder", the code finds me the only "thunder" words. i want to see "thundercats", "thuderbirds" or "thunderXXXXX" in the search results. i think u got it. thnx again my friend.
If there are no posts with exactly "windowsxp" then it will return nothing. I would have thought you meant "windows xp" though (with the space). That won't work unless you allow 2 character searches. If you are using fulltext search then that means recompiling mysql to allow 2 characters searches.

Lynne
12-01-2008, 05:18 PM
I think you would need to type in "thunder*" to see all posts with anything like what you said. Or even "*thunder*" to get "catsthundercats". Or, if you are using fulltext search, I think there is some option added to the usergroups in usergroup manager that gives permissions regarding searching (sorry, but I don't use fulltext search and so I don't see the option but I could swear it was there when I tested out fulltext search on my test site before.)