Do you run a guild website, DKP system or anything else, and you need item linking for your site? Well, theres a lot of different solutions out there in ways to do this, but this ones pretty new. With the introduction of the armory, now you can use Blizzard's website to grab item statistics, directly from the source! This guide will help you integrate item linking onto your site, and get you up and running fairly easily!
Heres an example of what your links will look like. Essentially, it will parse [item]Spire of Twilight[/item] and turn it into Purple: [Spire of Twilight]
If you are a "Do-it-Yourself" kinda person, I've zip'd the source code into one zip file, which can be located here:
http://jesta.us/item/wowitems.zip
This file contains all of the source, to get it running just up and on your own, on your own website. However, to integrate it into PHPBB and other applications, those steps will be illustrated below. So read on if you need assistance on its setup.
phpBB2 Installation
http://www.phpbb.com
The integration into PHPBB2 is pretty easy, I decided to just put it in the easiest method possible. The first step you need to do is download the file above, and extract the files into your PHPBB root folder, in a folder called "wowitems". The files should already be encased in that folder in the zip however, so just unziping it to the root should work too. After you unzip the files, follow these steps:
EDIT: viewtopic.php
FIND:
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
ADD AFTER:
include($phpbb_root_path . 'wowitems/tooltip.php');
EDIT: includes/bbcode.php
FIND: (Its in [function bbencode_second_pass])
$text = preg_replace($patterns, $replacements, $text);
// Remove our padding from the string..
$text = substr($text, 1);
ADD AFTER:
// WoWItems
$itemname = preg_replace("/\[item\](.*?)\[\/item\]/", '[|]$1[|]', $text);
$itemname = explode("[|]",$itemname);
foreach($itemname as $k => $i) {
if($k % 2 != 0){
$rarity[$i] = rarity($i);
}
}
$text = preg_replace("/\[item\](.*?)\[\/item\]/", '<a href="http://www.wowhead.com/?search=$1" class="[|[$1]|]" target="_new" onmouseover="showtipname(event,\'$1\');" onmousemove="showtipatcursor(event);" onmouseout="hidetip();"><b>[$1]</b></a>', $text);
foreach($rarity as $k => $i){
$text = str_replace("[|[".$k."]|]","r".$i,$text);
}
SAVE & CLOSE
OPEN: templates/YOUR_TEMPLATE/overall_header.tpl
FIND:
<head>
ADD AFTER:
<link rel="stylesheet" type="text/css" media="screen" href="../../wowitems/wowitems.css">
<script type="text/javascript" src="../../wowitems/wowitems.js"></script>
FIND:
<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}">
ADD AFTER:
<div style="display: none; position: absolute; z-index: 999999; top: 10px; width: 300px; left: 10px;" class="tooltip"
id="tooltipcontainer"><table><tbody>
<tr><td class="tl"></td><td class="t"></td><td class="tr"></td></tr>
<tr><td class="l"><q></q></td><td class="bg"><div id="toolBox"></div></td><td class="r"><q></q></td></tr>
<tr><td class="bl"></td><td class="b"></td><td class="br"></td></tr>
</tbody></table></div>
|
phpBB3 Installation
http://www.phpbb.com
Seeing as how PHPBB3 is in beta still, and not even RC1, the template formatting is constantly changing. This installation is a bit more difficult for that exact reason. Below is what you need to edit to get it to work, and just like in PHPBB2, you need to extract the files into the phpbb_root folder, into a folder called wowitems. Now the tricky part is editing the overall_header to add the DIV tags, and associate the javascript and the style sheets.
But first, take these steps:
EDIT: viewtopic.php
FIND:
{
$s_first_unread = $first_unread = true;
}
ADD AFTER:
include_once("wowitems/tooltip.php");
$message = itemparse($message);
|
Now, in order to edit the overall_header.tpl file, thats up to you. Theres various ways to do it, it just depends on what template you are using, and whether its stored in the database or as files. Once you manage to find the overall_header.tpl that the program is currently using, you will need to add the following code:
FIND:
<head>
ADD AFTER:
<link rel="stylesheet" type="text/css" media="screen" href="../../wowitems/wowitems.css">
<script type="text/javascript" src="../../wowitems/wowitems.js"></script>
FIND:
<body
ADD A FEW LINES AFTER:
<div style="display: none; position: absolute; z-index: 999999; top: 10px; width: 300px; left: 10px;" class="tooltip"
id="tooltipcontainer"><table><tbody>
<tr><td class="tl"></td><td class="t"></td><td class="tr"></td></tr>
<tr><td class="l"><q></q></td><td class="bg"><div id="toolBox"></div></td><td class="r"><q></q></td></tr>
<tr><td class="bl"></td><td class="b"></td><td class="br"></td></tr>
</tbody></table></div>
|
Once you get those in the actual template its using, the items will magically work on your PHPBB3 forums. Expect this topic to get updated once the final release of PHPBB3 is out.
For questions and comments, feel free to use the contact button in the upper right, and I will try to assist.