Sorry for the double post but just wanted to make sure people saw this.
I've had a go at making one, and tried to improve the original module :)
I don't have any experience in Drupal modules and only know a few bits of PHP but everyone is welcome to use what I've done.
I've managed to get everything working and made a few other changes to the module. The main problem I found was that Wowhead uses .htaccess redirects instead of javascript.
I also made a few changes so that item names with hyphens and apostrophes get looked up, and that if you type in an item like "murder" which normally gets a few hits on the search it will choose the exact match from the search results returned. I don't know why but I had to use file_get_contents instead of drupal_http_request as it wouldn't process the redirect otherwise.
I've also added all the colour so they display correctly (ie the epic ones and so forth)
The whole thing could probably do with tidying up a bit as I didn't rename the wowdb files I just edited the one in place. I've also got no idea how the thing runs performance or security wise so if someone wants to make some changes feel free.
The only other thing that could be done is that the case could be sorted out. The module will ignore case on the lookups but won't change it after it's processed. It would be nice if [item]mask of the watcher[/item] was changed automatically to [item]Mask of the Watcher[/item]. I had a go at playing with string replaces but Warcraft don't seem to do it uniformly. Maybe it could be replaced with the returned name somehow..?
You can see this in action if at http://www.heroicoutcasts.com
Thanks Mr Bikeybike for writing this thing in the first place, wouldn't know where to start otherwise!!
Comments
Comment #1
andy68man commentedNew version to fix backslash problem :)
Comment #2
andy68man commentedSorry found some additional bugs so here is another fix!
Comment #3
professorbikeybike commentedThanks for the patch! I'll try and review it this week, then commit it to CVS. Long term, if you're interested in co-maintaining this module, you should let me know...I released it, but haven't had the opportunity to provide it the attention it deserves.
Comment #4
Hoktar commentedHello...
Thanks for this Patch. It also works with the German version of wowhead?
Sorry for my Bad English, Im german.
Comment #5
andy68man commentedOoo I'm not sure!
For starters just change the links from "http://www.wowhead.com" to "http://de.wowhead.com" and see what happens.
Edit the following lines in item_dbs\wowdb.inc (open it in wordpad/notepad)
original:
define('WOWDB_BASE_URL', 'http://www.wowhead.com');
change to:
define('WOWDB_BASE_URL', 'http://de.wowhead.com');
original:
if ($url!="http://www.wowhead.com/?item=") {
change to:
if ($url!="http://de.wowhead.com/?item=") {
original:
drupal_set_html_head('<script src="http://www.wowhead.com/widgets/power.js"></script>'."\n");
change to:
drupal_set_html_head('<script src="http://de.wowhead.com/widgets/power.js"></script>'."\n");
You could also change the lines:
return t('Converts [item] tags to links/tooltips of the configured item database (WoW Head is the default).', array('!url' =>
And:
return t('You can include [item][/item] tags to automatically link the items to WoW Head. Either use the Item ID ([item]1234[/item]) or the exact name ([item]Earthwarden[/item])', array('!url' => WOWDB_BASE_URL));
To something more German if you wish. Good luck and let me know how it goes!
Comment #6
Hoktar commentedThanks i tested.
Comment #7
Hoktar commentedI have tested it. But it's works not. http://sdm.wowgilde.net
Comment #8
andy68man commentedTry testing with a new item and/or clearing the cache from the site. This tricked me up quite a few times!!
Comment #9
andy68man commentedI've checked out de.wowhead.com and unfortunately it looks like they use google search to search the german site :(
This means that you'll have to write new rules to get it working when it encounters an item with more than one hit. Some items such as [item]Splitterbesetzte Gamaschen[/item] should work however, and you should be able to use [item]27632[/item]
If you wanted to get it working with the search you will have to find out how to mod the line to look for the name: ie Terokks Federkiel - Gegenstand in the code and pull out the item number. Not easy!
Comment #10
Hoktar commentedI try a rule for http://speedydragon.gamestar.de/ to create.
Comment #11
andy68man commentedAh Brilliant! This is much closer to how Lootz works with wowhead! :)
Let me know how you get on, and if you get stuck.
Comment #12
illepic commentedJust posting to say THANK YOU! It's working great on our guild site at www.downfallguild.org. We love us some WoWHead!
Comment #13
Delishhious commentedI'd like to thank you for this module, helps a lot on my current site! I have a bit of problem though, I make gear guides with about 100 item links on the page, and when I save them all at once the apache server gives a time-out after 60 seconds. Is there any way to fix that?
Comment #14
andy68man commentedHey no probs guys happy to help :)
Marverick this is more Prof BikeyBike's area than mine, but I think once Lootz looks up a few items it will save them to an internal database rather than do a look up each time. Try adding in 20 items, saving the page, editing it and adding 20 more etc until you have all the links working. Also increasing the script timeout in your php.ini would help if you have access to the webserver. Once the whole page has been rendered it will be cached so it will be quicker the next time it opens.
Let me know how you get on.
Comment #15
professorbikeybike commentedandy68man got it right. For every item on the page, the first time around, the module is going to make calls out to wowhead or wowdb to get the item number. Once it has that, it's cached locally. So with 100 items, it isn't surprising that it times out with all those http requests. You could either add 20 at a time or so, then hit preview or save. The other alternative would be to just keep reloading the page until it's done.
Comment #16
Delishhious commentedThanks guys, that worked. I increased the time-out to two minutes and that allows me to add about 50 items at once. Keep up the good work :)
Comment #17
professorbikeybike commentedI'm closing this thread out. I've released a stable version that works with wowhead and incorporates the features added by andy68man.