MyBB Community Forums

Full Version: Search via url?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys, happy holidays!

I would like to know if there is any way to search inside the MyBB forum with a url.

Like google, for example: www .google. com/search?q=hello

I would like to make a list of motorbikes, and when you ckick on one of them, it just redirects you to a search inside a subforum with that model.

Explained in an other way as an example:

You click on an image of a "Yamaha R1" bike, and it links to a search inside the subforum "Bike models", searching Yamaha R1

is there any possible way of doing this ?

Thanks guys!!!

up! thanks
happy new year! any ideas?
not possible with the current system since the search needs a post key linked to your session as well as a way to set the internal variable holding the request method
And can I use a fake form? I've seen this:

Quote:Add this code where you want a search box.

<a name="top" id="top"></a>
<div style="float:right;">
<td class="trow1" align="center">
<form method="post" action="{$mybb->settings['bburl']}/search.php">
<input type="hidden" name="action" value="do_search" />
<input type="hidden" name="postthread" value="1" />
<input type="hidden" name="forums" value="all" />
<input type="hidden" name="showresults" value="threads" />
<input type="text" class="textbox" name="keywords" value="" />
<!-- start: gobutton -->
<input type="submit" class="button" value="Go" />
<!-- end: gobutton -->
</form>
</td>
</div>

Maybe doing a fake form all in one "a href" it may work... right?
the keys are per session and are tied to a form element. this is a security feature to ensure $_POST data comes from a form known to the system at the time it is submitted.

you would need a plugin or a separate PHP file to set the internal variable $mybb->request_method to "post" and then supply the $mybb->input['my_post_key'] variable and assign it to the current user's data
Thanks, I do not know a lot of PHP, but i cand defend myself on html.

I used this:

<form method="post" action="search.php">
<input type="hidden" name="action" value="do_search" />
<input type="hidden" name="postthread" value="0" />
<input type="hidden" name="forums" value="---FORUM ID---" />
<input type="hidden" name="showresults" value="threads" />
<input type="hidden" class="textbox" name="keywords" value="---SEARCH TERMS---" />
<input class="submit" type="submit" value="---SUBMIT HREF/BUTTON TITLE---">
</form>

and with css I made the button look like a Href.

.submit {

	border-top: 0;
	border-right: 0;
	border-left: 0;
	background: transparent;
	border-bottom: 1px solid transparent;
       &nbsp;color: #fff;
	display: inline;
	margin: 0;
	padding: 0;
}

.submit:hover {

	border-bottom: 1px solid #fff;

}

*:first-child+html .submit {		/* hack needed for IE 7 */
	border-bottom: 0;
	text-decoration: underline;
}

* html .submit {				/* hack needed for IE 5/6 */
	border-bottom: 0;
	text-decoration: underline;
}


Hope it helps somebody Wink