PHP-GTK2 Cookbook Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Correcting a module that is not working,,, (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Correcting a module that is not working,,,


#4163
JediMasterNerd (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Correcting a module that is not working,,, 2 Years, 6 Months ago Karma: 0  
I hope this isn't old news and that I haven't wasted time researching and finding a solution...

I've seen many people complain about installing the module and not having it work - they only get the loading icon despite having the pre-requisites... I've been playing with this module at different sites and it drove me crazy because on some sites it worked, otherwise it didn't --- all sites were hosted by GoDaddy.com.

I debugged the code and figured out what was happening for me. There may be a better solution than what I did, but I wanted to bring this up here so (1) the problem can be identified; (2) if a better solution exists I can replace my fix with something better; (3) the next version of googleWeather can get this addressed :-)

So the problem came down to the request.open throwing a TypeError exception, Access is denied. This is in the mod_GoogleWeather_ajax.js/gw_SendData function. Looking at the url, it was fine --- I even copied the url into my browser and it worked... But there was a problem there. After digging around it turns out that the sites that I've had the module working on were subdomains, all primary domains I had it installed on failed.

The end result... This was happening because the "www." is stripped off of the url --- if I recall correctly this is part of the apache mod_rewrite functionality. So if I went to http://domain.com it would work. If I went to http://my.domain.com it would work. If I went to http://www.domain.com it would NOT work as the JURI::base which is used for "url" does not have the "www." on it...

Since I believe this is an apache setting on GoDaddy I'm guessing I can't change the way it works, so I replaced the request.open with the following code:
Code:
		try {
			request.open( "GET", url, true );
		} catch (e) {
			url = url.replace("http://", "http://www.");
			request.open( "GET", url, true );
		}
This could be made more robust (checking for www already and adding another try/catch for the second open, but it fixed my problem and serves my needs... Hope this helps! J.
 
 
Last Edit: 2010/12/01 16:49 By JediMasterNerd. Reason: removed debug code showing in snippet
  The administrator has disabled public write access.

#4208
kksou (Admin)
Admin
Posts: 1680
graph
User Online Now Click here to see the profile of this user
Re:Correcting a module that is not working,,, 2 Years, 6 Months ago Karma: 27  
Hi,

Thanks much for sharing! I've not encountered this before, so this is new to me!

I've added your tips to the Google Weather FAQ.

I've sure you will save many other users many hours of debugging and frustrations.

Thanks and Regards,
/kksou
 
 
Last Edit: 2010/12/19 14:38 By kksou.
  The administrator has disabled public write access.



Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Blog - Forum - Privacy Policy - Contact Us
Links - Classes - Social Business - BPM - Web - General
Copyright © 2006-2013. kksou.com. All Rights Reserved