phpBB3 BBCode Help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Affe
Forum Newbie
Posts: 2
Joined: Tue Nov 17, 2009 3:28 pm

phpBB3 BBCode Help

Post by Affe »

I'm currently writing some custom BBCode for my site. Everything below works fine except for one thing - the single quote never gets replaced! I've tried multiple methods, from using .indexOf to remove it from the statement to the replace below. No matter what I do, it still gets through. I know it's not Javascript error, as I have a compiler and I've debugged it several times to find it working client-side.

BBCode:

Code: Select all

[mmoitem]{TEXT}[/mmoitem]
Replace Code:

Code: Select all

<script type="text/javascript">
 
var myOldString = "{TEXT}";
 
var myNewString = myOldString.replace(/ /g, "-");
var myNewString = myNewString.replace(/'/g, "");
 
var lnk = "<a href=http://mmo-champion.com target='_blank' title='mmo-champion.com'><img src='http://www.mmo-champion.com/favicon.ico'></a><a href=http://db.mmo-champion.com/i/" + myNewString + " target='_blank'>" + myOldString + "</a>";
 
document.write(lnk);
 
</script>
Affe
Forum Newbie
Posts: 2
Joined: Tue Nov 17, 2009 3:28 pm

Re: phpBB3 BBCode Help

Post by Affe »

I discovered that I had to use the following:

Code: Select all

var myNewString = myOldString.replace(/'/g, "");
Post Reply