A few weeks ago Jacob from gatheringmagic.com asked me if I could help him to integrate the MtG Helper into his phpBB. A full integration of the WordPress Plugin would require knowledge about phpBB. Knowledge I really don’t have. Therefore this is going to be a basic tutorial rather than a fully functional phpBB plugin. It’s a quick manual (or rather a small hack) on how to implement a tooltip into your forum.
So what do we need for tooltip to work?
-
The Tooltip-”Engine”
First of all we need a working JavaScript tooltip. For this small project I chose a tiny, tiny code snippet, which provided my with everything I needed. It was introduced by Alen Grakalic. For our purpose we have to modify the source a little bit. Instead of passing an complete path we only need to pass the card name to the function. Luckily all the card pictures are located in one directory (www.wizards.com/global/images/magic/general/). -
Implement the Tooltip-”Engine” in phpBB
Copy the tooltip.js inside your theme’s template directory. Should be something like: <phpBB3root>/styles/<theme name>/template/. After you have done this open the overall_header.html with your HTML-editor of choice (e.g Notepad++) and write these two lines inside the <header>: -
Add the BBCode
Custom BBCodes are added via the ACP. Click on the “Postings”-tab and then “BBCodes” to create a new BBCode.
But we’re not done yet. Passing the card name is fine as long the card doesn’t have any spaces, commas or primes but most card do have at least some spaces. That’s why we have to use a little replace function in order to adjust the image source path.
var cardname = this.name.replace(/ |%20/g,"_").replace(/,/g,"");
The name attribute will later be filled with the card name by the BBCode. As you might see there is no replace function for the primes. This is because ’ is used as a delimiter between strings and source code and the BBCode engine simply ignores text tokens with specials characters. Which is actually a good thing. Otherwise users could possibly exploit this to insert some XSS attacks
The last thing to do is to adjust the image source path correctly. I’ve done this for you already. Download the js file from here.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript" src="{T_TEMPLATE_PATH}/tooltip.js"></script>
Save the the file and close your editor. If you now refresh your forum you’ll see that the source code has not changed. Don’t panic! Rather open your Administration Control Panel (ACP), click on the “Styles”-tab and then on “Templates”. You’ll see a list of installed board themes. Click on your activated theme’s cache (e.g. if you have activated “prosilver” click the cache highlighted below).
Mark all template files and click “Delete marked”. This will erase the cache. If you know refresh and look at your source you’ll see the altered code.
Write into the “BBCode usage” text box:
[card]{SIMPLETEXT}[/card]And into the “HTML replacement” text box:
<a href="" name="{SIMPLETEXT}" class="preview">{SIMPLETEXT}</a>Check “Display on posting page”, click “Submit” and you’re done.
If you followed the instructions correctly you can now use the [card]-Tags like you would use them with the MtG Helper (Remember: Do not use primes. Just ignore them). I did those steps on a clean and local phpBB installation. Everything worked fine

Hope it helps,
Sebastian
Examples:












Subscribe by RSS
Thanks a lot for this guide, I sucessfully added this integration to our forum in a matter of minutes.
Would be possible to adapt mtg helper to joomla? It would be amazing.
Certrainly. But I have no plans to do that
This worked wonders for me thanks! Only thing I wish we could do is somehow bypass that ‘ cause all the cards I use have them in it =p
BTW if you use the MTG Draft simulator you can copy the text to forum and it automatically uses the [card] bbcodes.
Once again thanks for this! =)