miniBB Support Forums | 16 years on The Web
miniBB ®


 | Begin | Register | Reply | Search | Statistics | File Bank | Manual |
Re-cycled miniBB Support Forums / Re-cycled /   

Forum and topic bound search

Author Vodicka
#1 | Posted: 10 Dec 2008 06:15 
I was wondering how difficult it would be to implement seach function directly into 1) forum and 2) topic that would be limited just for the forum and topic respectively.

Please see examples on meebo:
(search this topic)
(search this forum)

Author Vodicka
#2 | Posted: 10 Dec 2008 06:20 
I mean very simple search box, please see the attached picture

Simple search box

Author Vodicka
#3 | Posted: 10 Dec 2008 06:27 | Edited by: Vodicka 
The first idea that came to my mind was to add hidden input to the search form that would contain forum`s or topic`s ID.

Somethnig like this (example is for searching within forum):

This one out:

<select class="textForm" name="forum"><option value="">{$l_AllForums}</option>{$listForums}</select>

This one in:

<input type="hidden" name="forum" value="forumID" />

When I put forumID as a number, it really worked.

But there are two problems I can see:

1. I dont know the variable I might use for forumID
2. I have no idea whether something similar might work in Topic too (searching just within topic)

Author Paul
Lead Developer
#4 | Posted: 10 Dec 2008 06:38 | Edited by: Paul 
Under Quick search bar HTML topic you will find an example of such form. There is nothing easier... just look at the source of miniBB's Search section and copy necessary parts to your template, making default values as hidden.

Currently miniBB doesn't allow to search within a topic (but I might consider this as a feature request, thanks). Actually, searching within a topic might be a rare operation, only if such topic is split by many pages. On a single page, use "Find" option of your browser ;-) let's say press Ctrl+F in Mozilla and search for a phrase...

Author Vodicka
#5 | Posted: 10 Dec 2008 06:50 | Edited by: Vodicka 
On a single page, use "Find" option of your browser ;-) let's say press Ctrl+F in Mozilla and search for a phrase...

Sure, I know. I am trying to come up with solution for ladies of all ages, though :-)

Are you saying that in this code...:

<form action="" method="get" class="formStyle" >

<input name="phrase" type="text" size="15" maxlength="50" class="textForm" value="" />

<input type="hidden" name="searchType" value="0" />
<input type="hidden" name="where" value="0" />
<input type="hidden" name="forum" value="" />
<input type="hidden" name="action" value="search" />
<input type="hidden" name="searchGo" value="1" />

<input type="submit" value="Quick Search" class="inputButton" /> <a href="#">Advanced search</a>


...where the forum field is not filled with anything it will search in the forum where the search form will be placed?

Author Vodicka
#6 | Posted: 10 Dec 2008 07:06 
No it does not work.

Let me put it in different words:

I need the form to know in advance (with no hassle on user side) that when it is placed on page that lists topics of forum ID8, it should search only within forum ID8 and nowhere else.

Author Vodicka
#7 | Posted: 10 Dec 2008 07:13 
It looks that I experimentally found the variable: {$frm}

Author Paul
Lead Developer
#8 | Posted: 10 Dec 2008 08:24 | Edited by: Paul 
I suppose the most correct value would be: 19 {$frm} comes for generating forums drop-down box.

But then you should keep in mind this form should appear ONLY on forum listing page. Because on other pages, such variable may not be available (or '0' (zero) would be available only which would lead to improper results).

Author Vodicka
#9 | Posted: 10 Dec 2008 08:55 
form should appear ONLY on forum listing page

Sure, I would put it in the main_topics.html template.

Re-cycled miniBB Support Forums / Re-cycled /
 Forum and topic bound search
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message

Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.

Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.


miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Install the Captcha add-on: protect your miniBB-forums from the automated spam and flood.