Forum Moderators: coopster
Hello all,
I need some help reversing this code. I am trying to pull some data from my db and then output it formatted with BBCode for editing. Any help would be appreciated. Thanks in advance.
$simple_search = array(
'/\[b\](.*?)\[\/b\]/is',
'/\[i\](.*?)\[\/i\]/is',
'/\[u\](.*?)\[\/u\]/is',
'/\[img\](.*?)\[\/img\]/is',
'/\[url\=(.*?)\](.*?)\[\/url\]/is',
'#\[youtube\]([a-zA-Z0-9-_]+)\[/youtube\]#i');$simple_replace = array(
'<strong>$1</strong>',
'<em>$1</em>',
'<u>$1</u>',
'<center><img src = "$1"></center>',
'<a href="$1">$2</a>',
'<center><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/\1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/\1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object></center>');
$post = preg_replace($simple_replace, $simple_search, $post);
Reading and displaying the data? Or updating the data?
Probably just read/display. You are going to be invoking a search/replace every time the information is requested. I think your original thought process was likely the better solution -- store it as you intend to use it most often.