Jump to content

bbcode


deathadder

Recommended Posts

i am looking to add bbcode to my toplist service for description, i have a working code but it wont allow for example

 

echo $descr; instead os displaying the description it just displays the text descr

 

here is my code

 

<?php
function BBCode ($string) {
$search = array(
     '#\[b\](.*?)\[/b\]#',
     '#\[i\](.*?)\[/i\]#',
     '#\[u\](.*?)\[/u\]#',
     '#\[img\](.*?)\[/img\]#',
     '#\[url=(.*?)\](.*?)\[/url\]#',
     '#\[code\](.*?)\[/code\]#'
);
$replace = array(
     '<b>\\1</b>',
     '<i>\\1</i>',
     '<u>\\1</u>',
     '<img src="\\1">',
     '<a href="\\1">\\2</a>',
     '<code>\\1</code>'
);
return preg_replace($search.'si', $replace, $string);
}
?>
<?php
echo BBCode('Here is some [b]Bold![/b] and so on!');
?>

 

this works perfectly but as soon as i put something along the lines of this

 

echo BBCode('$descr'); it wont display anything but the text $descr

Link to comment
https://forums.phpfreaks.com/topic/262987-bbcode/
Share on other sites

i did try this, but it displayed an error to reprove it ill redo it and screen error

 

 

update

 

 

 

http://prntscr.com/9kzgr

 

 

 

the description would be inbetwean those 2 lines normally

go to rspsdb.org/serverpage.php?server=PKXILE to see what i mean

 

well it displays it, but it deosent show in bbcode

Link to comment
https://forums.phpfreaks.com/topic/262987-bbcode/#findComment-1347921
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.