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
Lockslap
The only help I could offer would be to rewrite the script to use fsock to read from Wowhead. I have found that cURL is faster, and much easier to work with. When I first started writing the script it used fsock, and would get high page load times if the post had a lot of items linked. After they were added to the cache it went away, but with cURL it doesn't cause any high load times regardless if the items are in the cache or not.
EDIT
I am rewriting portions of the script to use cURL as default, but if it isn't installed, it will use fsock.
EDIT #2
The newest version is up. I have changed the way the script queries Wowhead, based on the settings of their PHP installation. If cURL is enabled, the script will use it. If not it will use either 'file_get_contents()' or 'fsock' based on further settings. If the script is currently working for you, it is not necessary to update, no other changes were made. Thank you for bringing this to my attention.
Post by
90697
This post was from a user who has deleted their account.
Post by
90697
This post was from a user who has deleted their account.
Post by
Lockslap
Very helpful information, much appreciated.
Concerning the item colorings, I am rewriting the XML parsing to use the quality ID from the XML file, rather than the worded quality. XML will be parsed used SimpleXML, rather than the generic class I have been using. This way, language is irrelevant.
Concerning table_scheme.sql, the line was originally in there, but only saved locally on my computer. When I got everything off of my webserver for the new release (I edit everything remotely), the old version of 'table_scheme.sql' was used. Thanks for bringing this to my attention!
For the using a special 'power.js' script depending on the language, this is the way it what when I had originally tested it. Having just looked at the code to 'power.js', it seems this has been changed.
It seems that when you view an item's XML page using another language its link is always shown in the English version. For example,
http://de.wowhead.com/?item=24262&xml
(Spellstrike Pants), show's the link to be in English. I smell a code bug!!! In light of this info, I will have it generate links on the fly.
Post by
Lockslap
While reading through parse.php I also noticed that you handle quests two times with almost the same code. Is that intended?
Yes, one is for IDs, hence the '{1,10}' regular expression, aka a number 1-10 digits long. This is due to the different ways I have to get the information depending on what info the script is given to start (name or id). I am working as we speak to combine them, and clean things up a bit. Most of this code was written in a hurry.
edit3:
I'm such a god! Inside the cache item qualities are stored dependant on the language you selected. So, instead of "Epic" I get "Episch". When manually changed to "Epic" the link is colored again.
So you just have to convert the quality captions. ;P
Oh, and by the way: I can confirm that there are no problems when viewing a german item link with an english board setting, as long as the cache is used.
But excellent work so far!
If you're a god for finding that, what does that make me given I wrote this entire script? =D
Post by
Lockslap
I'm thinking that complete rewrite of
parse.php
is in order. I'm thinking I may write a class to handle all of this stuff. This would give me an incentive to read up on classes, given that I haven't written one in quite some time.
Post by
90697
This post was from a user who has deleted their account.
Post by
Lockslap
I've been using PHP for about 8 years now (lol I'm only 23), and only started using SQL about 2 or 3 years ago. The reason my code looks so crappy (I feel sorry for those that read it) is because everything I know about PHP/SQL was learned on my own. Never had the time or money to take any classes. Without open-source code, I wouldn't know hardly anything about PHP.
Post by
90697
This post was from a user who has deleted their account.
Post by
Lockslap
Let me know how it goes, I'm definitely interested.
Post by
90697
This post was from a user who has deleted their account.
Post by
156587
This post was from a user who has deleted their account.
Post by
90697
This post was from a user who has deleted their account.
Post by
156603
This post was from a user who has deleted their account.
Post by
90697
This post was from a user who has deleted their account.
Post by
Lockslap
craCkpot thank you for a very cool mod.
I downloaded the wowhead.zip today (5/29), and I am having the same problems that Sasheem had on page one of this topic. Basically, the spell and quest tags work, but the item tags do not. It looks as if instructions have changed since you first posted them, because after reading all the posts, I do not see in the instructions where you say to edit bbcode.php and there isn't a functions_wowhead.php in the .zip file anymore. I've noticed some other slight differences in the current instructions verses helpful suggestions later on as well. So, it seems that those sections no longer apply and I'm confused as to how to fix the issue.
I have tried to turn my caching on and off in the config.php, but it does not change how the item tags work. Basically, what shows up in the post is a pair of brackets with nothing in them, and mousing over brackets shows that there is a link back to my forum, where as the spell and quest tags when moused over bring up the appropriate spell or quest and point to wowhead.
Looking in the phpbb_wowhead_cache table, I can see where it has cached some of the requests that I have tried to make for items, and the cache for spells and quests. From the data items, I see that there is nothing in the name, link and quality columns and the ItemID is 0. Whereas that data is filled for spells and quests.
Any suggestions?
EDIT: After posting this, it looks like a couple of other folks directly above me are having the same issue.
First of all, the instructions that are at the beginning of this thread are the ones that should be followed. The script has taken on many changes and the help that I have given throughout this thread changes based on the current status of the script. I do not have the ability to remove any posts (other than my own) from this thread, so you just have to bare with it.
As for all of the SQL errors that people are getting, you have to pay attention to what the error is. If the script is not functioning properly and doesn't get the info it needs, then attempts to add it to the database, then it will produce an error. As I have said in the past, my webhost does not have MySQLi installed, and I have no way of testing this script out in that environment. Furthermore, I have never used MySQLi, and from what I've seen it is more strict on the syntax used for its queries.
As for the reason for the script not properly getting the information about items is Wowhead as apparently changed their XML. It is returning information that my script does not know how to handle. I am not sure why this is, and am looking into how to fix it. If anyone has any idea how to fix it, please let me know.
EDIT
While I am waiting on a response from Wowhead I am going to change the script over to use SimpleXML to handle the XML parsing, perhaps this will fix the issue.
Post by
12688
This post was from a user who has deleted their account.
Post by
Lockslap
Keep in mind that SimpleXML is PHP5 only.
Another option would be to look into MiniXML (
http://minixml.psychogenic.com/
) but unfortunately that would be another external library you would have to use.
I've had no issues using it, but I know someone else probably won't like the idea of having to use it.
Edit: I was getting insert errors as well. If you are getting them, go to includes/functions.php, and at line 89 change
curl_setopt($curl, CURLOPT_HEADER, 1);
to
curl_setopt($curl, CURLOPT_HEADER, 0);
This will turn the return headers off, and seemed to allow the xml parser to work properly (why it wasn't erroring, I don't know).
Please do not suggest changing code if you have not taken the time to see exactly the purpose for it being in there. Obviously, if I didn't want headers, I wouldn't have added that line. Here is the reasoning for it being there: If you disable headers and try to link a spell/quest that when searched for redirects to the spell/quest's page then it will break the script. For example,
http://www.wowhead.com/?search=feral+charge
takes you directly to
http://www.wowhead.com/?spell=16979
, and then I would not have any information. I do not want cURL hopping around and taking more time to get whatever information I need. When it sees the 'Location:' header, it grabs it and then gets the spell/quest's item out of it and that's it. Voila!
Anywho, I have fixed the issue with the script not properly getting information that we needed. My solution is to use SimpleXML and allow it to read CDATA.
If you are NOT running PHP 5.x then the script will not work.
Odds are good that most of you are, but I'm just letting you know. Even my host upgraded to PHP5, and he's slow about doing all of that stuff.
And finally, I am in the process of doing a complete rewrite of the core of this script. This will hopefully make things much more efficient and cleaner. I'm leaning towards making it dependant on cURL and SimpleXML, which would alienate some people who do not have either of these installed/enabled on their webserver, but this seems to be the quickest way to get the information that I need. I will keep an open mind, and try new ways to avoid requiring these modules be installed/enabled, but we'll see.
I will be releasing this newest version later on today, I just have to write the code to strip out the headers if the 'Location:' header is not found, because SimpleXML does not like when the headers are in the code, lol.
Post by
xodium
1st of all thank you for this easy and simple mod to install, however I changed my PHPBB3 theme last week, did the whole instructions again, and while quests and spells do work (linking name and tooltip), any item just appears as a blank bracket with no text or tooltip, is there anything I am missing?
Or is this something related to:
"As for the reason for the script not properly getting the information about items is Wowhead as apparently changed their XML. It is returning information that my script does not know how to handle. I am not sure why this is, and am looking into how to fix it. If anyone has any idea how to fix it, please let me know."
This is what I have been trying on my forums, with success only on the 1st and 3rd link.
Frost Nova
Shadowfang
Retrieving the Goods
Thanks once again for this awesome simple modification!
Post by
srelysian
1st of all thank you for this easy and simple mod to install, however I changed my PHPBB3 theme last week, did the whole instructions again, and while quests and spells do work (linking name and tooltip), any item just appears as a blank bracket with no text or tooltip, is there anything I am missing?
Or is this something related to:
"As for the reason for the script not properly getting the information about items is Wowhead as apparently changed their XML. It is returning information that my script does not know how to handle. I am not sure why this is, and am looking into how to fix it. If anyone has any idea how to fix it, please let me know."
This is what I have been trying on my forums, with success only on the 1st and 3rd link.
Frost Nova
Shadowfang
Retrieving the Goods
Thanks once again for this awesome simple modification!
At some point, wowhead changed their code causing the item codes not to work. craCkpot says he's got a fix in the works (as stated in the post right before yours), and will be releasing it today (hopefully). The quest and spell codes both work, however the items do not. If you wanted to temporarily get around it until it is fixed, you can just create the links yourself and the tool tips will still work since he code was designed to convert the codes into links the wowhead java app will detect and show.
\
\
It won't do the fancy color coding, but at least you can still get the hovering item info :)
Post Reply
This topic is locked. You cannot post a reply.