Posted on: 2004/8/19 10:15
MS_Weather - Few questions
This is a neat module, I'm really enjoying it! A few of things I need a little help with though.
1) Background color for the Current Conditions - Very dark and all one color.. this isn't the case in IE, but in Firefox it is dark grey. Maybe firefox needs '#' for bgcolors or something, I don't know. This is the same on qmel.com where I got the module.
the problem is coming from the Doctype declared with XOOPS. Yahoo probably doesn't even decalre one. Firefox listens and won't post the colors if they don't have #'s, IE does though. so that is why the #'s don't matter on yahoos page but they do in xoops. solution: see end of post....
2) If I search for a US Postal Zip Code I get results with Fahrenheit, which is what is desired for me. If I search for city name I get Celsius. Any way to fix this behavior? edit: I just noticed that if you search for "us zip code" or "city, state, usa" it shows up in fahrenheit. if you search for "city, state" or "city" the result is in Celsius.
3) When you click on "Other Cities" in the block it defaults to Montpelier. Anyway to change that?
... changed a line with Montpelier in class.msweather.php to end like this:
I looked through some of the files for possibilities to change some of these things, but I didn't see anything pop up for me, I don't know PHP. The config file for the colors is very nice, I just wish there were a few more attributes in there.
you can see my setup Here
edit: enabled public viewing for the module. sorry.
found a way to fix the formatting on this module allowing colors in Mozilla and better font size and colors as well.
for the main ms_weathher index view. find this section in the class.msweather.php
/* function get_msw_getmoduledata()
several lines down, before this line:
$MSWModule .= "<center>".$all[ 1 ]."</center><br><br>";
$all[ 1 ] = preg_replace("/bgcolor=(?!#)/", "bgcolor=#", $all);
$all[ 1 ] = str_replace( "td width="25%"", "td width="33%"", $all[ 1 ]);
$all[ 1 ] = str_replace( "<font face=Arial size=3>Currently:", "<font color="#000" face=Arial size=3>Currently:", $all[ 1 ] );
$all[ 1 ] = str_replace( "<font size="5"", "<font size="5" color="#000"", $all[ 1 ] );
$all[ 1 ] = str_replace( "High:", "</font><font face=Arial color="#000" size=3>High:", $all[ 1 ] );
$all[ 1 ] = str_replace( "Low:", "</font><font face=Arial color="#000" size=3>Low:", $all[ 1 ] );
$all[ 1 ] = str_replace( "td align=left width="50%"><font face=Arial size=3><b>", "td align=left width="50%"><font face=Arial size=3 color="#000"><b>", $all[ 1 ] );
this will add the missing # to allow Mozilla browsers to use colors in the tables. Since XOOPS declares a higher XHTML or HTML 4.01 Doctype and Yahoo declares none, this is necessary to make the page look like it does on Yahoo. This will also do some better text formatting and colors as well. In retrospect you could just use a few replaces and add a class and use that in your CSS, but this is working. This also fixes one of the table widths to match the others, so it looks better.
for the blocks view, I am working on that, almost have it tweaked now. edit later.
maybe some of these problems are with international versions of Yahoo? I don't know, but it looks ok for me now.