This site makes extensive use of JavaScript.
Please enable JavaScript in your browser.
Live
PTR
10.2.7
PTR
10.2.6
Beta
Add Wowhead tooltips to your forums or CMS.
Return to board index
Post by
172509
This post was from a user who has deleted their account.
Post by
172729
This post was from a user who has deleted their account.
Post by
Lockslap
Yep, I use phpBB3 portal as well and here's how to get the script working with it:
Open "./portal/includes/functions.php" and look for the following line (it should be near the top of the page):
include($phpbb_root_path . 'includes/message_parser.'.$phpEx);
Immediately after it add:
include_once($phpbb_root_rath . 'wowhead/parse.php');
Next, inside the same file, look for the following lines:
// Parse the message and subject
$message = censor_text($row);
$message = str_replace("\n", '<br />', $message);
Immediately after it add:
$message = whp_parse($message);
Save and close functions.php and reupload it to your website, as needed.
You may or may not have to clear your cache, I'm not sure if the cache is used by the portal.
That's it, you're done. Enjoy!
I have added this to my portal page and for some reason it will not get all the items only certain items from certain posts but when you click the news item to open the forum they all work you can see it at
http://twistedandconfused.net
My suspicion is that it may have something to do with the attachment located on that post. Because if you look at the post that doesn't have an attachment with it, its working. As to why this would be an issue I'm not exactly sure.
By the way, grats on the Naj'entus kill!!! I just got
The Maelstrom's Fury
for my lock, its a beast until you can get the Tempest of Chaos.
Post by
172729
This post was from a user who has deleted their account.
Post by
Lockslap
Yes it is all finished, but I never intended to release it to the public. It was written specifically for the website of the guild I was in, and am no longer in.
Post by
Lockslap
I decided that
most
of the bugs have been worked out and it seems to function properly regardless of MySQL or MySQLi. Therefore, I have released version 2.1, which is basically 2.0.6BETA with some minor improvements. If you are running 2.0.6beta then you do not need to upgrade to 2.1, unless you want to. There were no major changes.
Download:
http://code.google.com/p/wowheadtooltips/downloads/list
Post by
Talonos
ok one question i have got is how to i incorperate this into my portal coz i've got it working brillinat on my forum now but portal links not working and i cant find how to add it to the portal
Post by
Lockslap
ok one question i have got is how to i incorperate this into my portal coz i've got it working brillinat on my forum now but portal links not working and i cant find how to add it to the portal
there is a post a i made somewhere in this thread about how to make it work with portal. note, this only applies if you're using phpBB3Portal, not any others.
Post by
172729
This post was from a user who has deleted their account.
Post by
Lockslap
You would have to query wowhead to find the URL to the file and then create a link to that url and Wowhead's JS file will automatically create a tooltip for it. If you're using PHP5 you could use SimpleXML to do it rather easily. I would recommend modifying the SQL table or creating a new to hold all of the URLs for each item that is linked to prevent any excessive load times due to having to query wowhead every time someone loads/reloads the page.
Change your HTML block to the following:
<table class="tablebg" cellspacing="1" width="100%">
<tr>
<td class="cat"><h4>Latest Loot</h4></td>
</tr>
<td class="row1">
<!-- BEGIN latest_loot -->
<a href="{latest_loot.ITEMLINK}" target="_blank">{latest_loot.ITEMNAME}</a><br />
<!-- END latest_loot -->
</td>
</tr>
</table>
and the PHP portion (this is assuming that you're using PHP5 w/ SimpleXML enabled. It does not handle whether or not the item exists in the cache if you choose to include it. i am going to use cURL to query wowhead, but you could use whatever you feel comfortable with):
<?php
if (!defined('IN_PHPBB'))
{
exit;
}
$sql = 'SELECT item_name, item_buyer
FROM ' .eqdkp_items. '
ORDER BY item_date DESC';
$result = $db->sql_query_limit($sql, 5);
while( ($row = $db->sql_fetchrow($result)) && ($row != '') )
{
// get the link from wowhead
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, '
http://www.wowhead.com/?item='
. urlencode($row) . '&xml');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl);
curl_close($curl);
// use SimpleXML to handle XML parsing, and remove any CDATA entries
$xml = simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA);
if ($xml->error == '')
{
// item not found, so return a blank link
$template->assign_block_vars('latest_loot', array(
'ITEMLINK' => '#',
));
}
else
{
// otherwise return the link
$template->assign_block_vars('latest_loot', array(
'ITEMLINK' => $xml->item->link,
));
}
$template->assign_block_vars('latest_loot', array(
'ITEMNAME' => censor_text($row),
'ITEMBUYER' => censor_text($row),
));
}
$db->sql_freeresult($result);
unset($xml);
?>
this should work, but keep in mind that it is 6am and i'm tired. i ran it through my local PHP parser and it came up with no errors, so syntax wise its good. this is basically the exact way that I did my version for my former guild's website.
hope this helps.
Post by
172729
This post was from a user who has deleted their account.
Post by
Lockslap
if it doesn't produce any errors then you have simplexml and curl enabled on your server.
i looked over the code now that im not half-asleep, and there was a minor bug. it was looking at errors when there were none...oops? i also neglected to add the link colors, so i added that as well.
so here's the new HTML:
<table class="tablebg" cellspacing="1" width="100%">
<tr>
<td class="cat"><h4>Latest Loot</h4></td>
</tr>
<td class="row1">
<!-- BEGIN latest_loot -->
<a class='q{latest_loot.ITEMQUALITY}" href="{latest_loot.ITEMLINK}" target="_blank">{latest_loot.ITEMNAME}</a><br />
<!-- END latest_loot -->
</td>
</tr>
</table>
and the PHP:
<?php
if (!defined('IN_PHPBB'))
{
exit;
}
$sql = 'SELECT item_name, item_buyer
FROM ' .eqdkp_items. '
ORDER BY item_date DESC';
$result = $db->sql_query_limit($sql, 5);
while( ($row = $db->sql_fetchrow($result)) && ($row != '') )
{
// get the link from wowhead
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, '
http://www.wowhead.com/?item='
. utf8_encode(urlencode($row)) . '&xml');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl);
curl_close($curl);
// use SimpleXML to handle XML parsing, and remove any CDATA entries
$xml = simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA);
if ($xml->error != '')
{
// item not found, so return a blank link
$template->assign_block_vars('latest_loot', array(
'ITEMLINK' => '#',
'ITEMQUALITY' => '4',
));
}
else
{
// otherwise return the link and quality
$template->assign_block_vars('latest_loot', array(
'ITEMLINK' => $xml->item->link, // item link from xml
'ITEMQUALITY' => $xml->item->quality, // quality id to determine link color
));
}
$template->assign_block_vars('latest_loot', array(
'ITEMNAME' => censor_text($row),
'ITEMBUYER' => censor_text($row),
));
}
$db->sql_freeresult($result);
unset($xml);
?>
let me know how it works for ya.
Post by
172729
This post was from a user who has deleted their account.
Post by
Lockslap
Its making a separate link for each query, so I combined them to make it set everything at once.
PHP Code:
<?php
if (!defined('IN_PHPBB'))
{
exit;
}
$sql = 'SELECT item_name, item_buyer
FROM ' .eqdkp_items. '
ORDER BY item_date DESC';
$result = $db->sql_query_limit($sql, 5);
while( ($row = $db->sql_fetchrow($result)) && ($row != '') )
{
// get the link from wowhead
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, '
http://www.wowhead.com/?item='
. utf8_encode(urlencode($row)) . '&xml');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl);
curl_close($curl);
// use SimpleXML to handle XML parsing, and remove any CDATA entries
$xml = simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA);
if ($xml->error != '')
{
// item not found, so return a blank link
$quality = '4';
$link = '#';
}
else
{
// otherwise return the link and quality
$quality = $xml->item->quality;
$link = $xml->item->link;
}
$template->assign_block_vars('latest_loot', array(
'ITEMNAME' => censor_text($row),
'ITEMBUYER' => censor_text($row),
'ITEMLINK' => $link,
'ITEMQUALITY' => $quality,
));
}
$db->sql_freeresult($result);
unset($xml);
?>
we'll see how that goes...
Post by
172729
This post was from a user who has deleted their account.
Post by
169528
This post was from a user who has deleted their account.
Post by
Lockslap
I have updated to 2.1. but the same Problems. Have nobody the same problem with php 4 ?
The first problem that I can tell is that you're using phpBB2. This script was designed and coded to work with phpBB3. It has been proven to work on phpBB2, but I do not support that, and you install it at your own risk. I have posted in a previous thread the instructions to use when installing on a phpBB2 forum, but that for was for the old version of this script, and it has been completely redesigned since then, and I cannot assure you that it will still work properly. If you want this script to work, I would
HIGHLY
recommend that you upgrade to phpBB 3.x. You can keep your database in tact and just do an upgrade installation.
It seems when I try to make a post on your forums I get the white screen, regardless of whether or not I attempted to link an item. This tells me that you most likely followed the phpBB3 instructions, which is a bad idea because phpBB2 and phpBB3's code and structure of how it handles things is
completely
different.
So yeah, its not the script that is causing the problem, it is most likely due to an error in the installation.
Post by
169528
This post was from a user who has deleted their account.
Post by
Lockslap
It appears that the board is actually saving the posts made in that forum. Looking at the source code it seems that you may still be using another script to handle tooltips as well, perhaps ItemStats.
<script type="text/javascript" src="ajax_tooltip/js/ajax-dynamic-content.js"></script>
<script type="text/javascript" src="ajax_tooltip/js/ajax.js"></script>
<script type="text/javascript" src="ajax_tooltip/js/ajax-tooltip.js"></script>
<link rel="stylesheet" href="ajax_tooltip/css/wow-item.css" type="text/css" />
If this is the case, then it may be possible that the scripts are conflicting with each other.
Post by
firelynx
just wanted to say thanks for the code crackpot. after 3 days of mucking around with itemstats and wowhead support i gave up, and had your code working perfectly on my board in 10 minutes :D
Post Reply
This topic is locked. You cannot post a reply.