Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.