...

View Full Version : BBCode help



ole90
12-21-2007, 01:03 PM
heres my code:


function icode($text)
{
$search = array('/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[url\=(.*?)\](.*?)\[\/url\]/is', '/\[center\](.*?)\[\/center\]/is', '/\[img\](.*?)\[\/img\]/is');
$replace = array('<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<a href="$1" target="_blank">$2</a>', '<center>$1</center>', '<img src="$1" border="0">');
$string = preg_replace($search, $replace, $text);
return $text;
}


$article = icode($article);

But that doesn't seem to be working =X Any help?

Inigoesdr
12-21-2007, 01:15 PM
Hint:

function icode($text)
{
$search = array('/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[url\=(.*?)\](.*?)\[\/url\]/is', '/\[center\](.*?)\[\/center\]/is', '/\[img\](.*?)\[\/img\]/is');
$replace = array('<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<a href="$1" target="_blank">$2</a>', '<center>$1</center>', '<img src="$1" border="0">');
$string = preg_replace($search, $replace, $text);
return $text;
}

ole90
12-21-2007, 01:32 PM
lol thanks *slaps self*



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum