Re: Re: BBCode?

From: Date: Mon, 25 Nov 2002 06:49:24 +0000
Subject: Re: Re: BBCode?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-125890@lists.php.net to get a copy of this message
Thanks, but that isn't what I want. The point behind BBCode is allowing a small, simpler, securer, subset of HTML. I.e. [img=http://domain.com/image.gif] changes to <img src="http://domain.com/image.gif" alt="" />
In that case: <?php function bbcode($text){ $text = ereg_replace("(\\[i\\])([^\\[]+)(\\[/i\\])",'<i>\\2</i>',$text); return $text; } print bbcode('[i]This[/i] is a [i]test[/i].'); ?> Prints: <i>This</i> is a <i>test</i>. -- Kyle Gibson admin(at)frozenonline.com http://www.frozenonline.com/

« previous php.general (#125890) next »