BBcode for forum search

We know you have an opinion on how things should be run around here. These are suggestions for the forums, and the website.This forum is not a place to ask for suggestions to your own coding (or otherwise) problems.

Moderator: General Moderators

Post Reply
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

BBcode for forum search

Post by scorphus »

Hi Jason,

In the spirit of evolution and improvement of the forum on behalf of a better community I came into a new BBcode addition to perform a search in the forum.

The new BBcode I would like to suggest are the following, for example:

Code: Select all

їsearch]evolution and better and communityї/search]

and

їsearch=scorphus]evolution and better and communityї/search]
which are replaced by: evolution and better and community and evolution and better and community (by scorphus).

Here is a code with the regular expressions and the replacement strings:

Code: Select all

<?php
//[search]keywords[/search]
$regExp = "#\[search\](.*?)\[/search\]#si";
if (preg_match($regExp, $str, $regs)) {
	$rep = '<a href="http://forums.devnetwork.net/search.php?search_keywords=$1">$1</a>';
	$str = preg_replace($regExp, $rep, $str);
}

//[search=author]keywords[/search]
$regExp = "#\[search=(.*?)\](.*?)\[/search\]#si";
if (preg_match($regExp, $str, $regs)) {
	$rep = '<a href="http://forums.devnetwork.net/search.php?search_keywords=$2&search_author=$1">$2 (by $1)</a>';
	$str = preg_replace($regExp, $rep, $str);
}
?>
Also, you can click http://scorphus.no-ip.com/lab/bbcode/ and see a working example.

I hope it is ready to be added to the forum.

Cheers,
Scorphus.
Deemo
Forum Contributor
Posts: 418
Joined: Sun Jan 18, 2004 11:48 am
Location: Washington DC

Post by Deemo »

that would be really useful. i like it :)

also, it would be cool if it could link to google 8O
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

we already can link to google. :roll:
Deemo
Forum Contributor
Posts: 418
Joined: Sun Jan 18, 2004 11:48 am
Location: Washington DC

Post by Deemo »

now i feel stupid lol
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it's okay.. I sometimes forget about the other features because I use the quickie most of the time. :) :lol:
Post Reply