lumix
July 15, 2011, 11:13am
1
someone can explaine and add for this a href parser?
from database row[9] i got all text, but i dont know how to convert this
[url=http://www.page.com ]klik[ / url] to working ahref link
<a href="http://www.page.com">klik</a>
$sTemplate = <<<EOT
<!-- POST -->
EOT;
$sParsed = str_replace(array(
"<!-- POST -->",
"[center]", "[/center]"),
array(
$row[9],
"<center>", "</center>"),
$sTemplate );
echo $sParsed;
It looks like you’re using BBCode, you could try the following:
$Text = preg_replace("/\\[url\\]([$URLSearchString]*)\\[\\/url\\]/", '<a href="$1">$1</a>', $Text);
$Text = preg_replace("(\\[url\\=([$URLSearchString]*)\\](.+?)\\[/url\\])", '<a href="$1">$2</a>', $Text);
lumix
July 15, 2011, 6:57pm
3
i do not know how to add to work he with bbcode parser
lumix
July 16, 2011, 2:05am
4
fixed thanks
sorry for doublepoost but i didnt know why i cant edit post…
that code should work regardless of any BBcode parser