Page 33 of 54
Re: Now available: AJAX/PHP multilingual website templates
Posted: Thu 06 Oct 2011 9:38 pm
by nitrx
I think i"ve to substitute jpg in gif ?
Code: Select all
$IconsLarge = array(
"skc.jpg", // 0 imagesunny.visible
"nskc.jpg", // 1 imageclearnight.visible
"bkn.jpg", // 2 imagecloudy.visible
"sct.jpg", // 3 imagecloudy2.visible
andso-on ...
Re: Now available: AJAX/PHP multilingual website templates
Posted: Thu 06 Oct 2011 9:52 pm
by saratogaWX
Ummm... no.. you don't need to change the specific scripts. On WXForum.net I'd said
For those with template sets, I've updated multiple scripts to support the new animated GIF icon sets:
Template updates at
http://saratoga-weather.org/wxtemplates/updates.php
Scripts updated:
plaintext-parser.php (WXSIM formatter)
WU-forecast.php (International WeatherUnderground forecast)
advforecast2.php (NWS forecast)
ajax-dashboard.php (the default one, not the alternative dashboard from websterweather)
ajaxWDwx.js (Weather-Display conditions icon update)
Settings.php (add a new setting to specify forecast/condition icon type)
get-metar-conditions-inc.php (support for animated icons)
ajax-images/*.gif (added corresponding conditions icons to set)
Note: you'll need to visit
the animated icon download site, unpack the .rar file into your forecast/images/ directory and upload it for the scripts to find the new forecast icons.
Thanks to Paolo for letting me include some of his set in the distribution files for use as conditions icons!
Using the
http://saratoga-weather.org/wxtemplates/updates.php and set the query for 1 Oct 2011 with your Base and Cumulus-plugin will get you all the files that are needed in the stock templates. You'll also have to put the Meteotreviglio .gif icons in your forecast/images/ directory (where your current .jpg forecast icons reside).
Then in your Settings.php, just add
Code: Select all
$SITE['fcsticonstype']= '.gif'; // default type='.jpg' -- use '.gif' for animated icons from http://www.meteotreviglio.com/
and the dashboard and forecast script(s) will all use the animated icons.
Best regards,
Ken
Re: Now available: AJAX/PHP multilingual website templates
Posted: Thu 06 Oct 2011 9:58 pm
by nitrx
Aha well I've to do something tommorow thanks for explaining

Re: Now available: AJAX/PHP multilingual website templates
Posted: Thu 06 Oct 2011 11:13 pm
by gemini06720
saratogaWX wrote:The Cumulus realtime.txt does not currently have a 'icon number' for current conditions (unlike Weather-Display's clientraw.txt), so no AJAX update is currently possible.
Ken, a little correction to your statement...
The Cumulus-produced 'realtime.txt'
does contain a forecast number, field number 49 "The number of the current forecast as per Strings.ini. If the forecast is not being provided by the station and not being generated by Cumulus a value of 0 (zero) is returned" - this is equivalent to the "<#forecastnumber>" Webtag.
The number contained in field #49 (of 'realtime.txt') might not refer to an icon as such, but that number can easily be associated with a group of icons - many of us have done so. The only negative aspect with the 'realtime.txt' forecast number is that it is based on a formula (the
Zambretti Forecaster) which calculates the forecast 12 hours into the futur - not a near-immediate forecast (1-6 hours in the futur) as offered by software such as Weather Display, WXSIM and services such as METARs, Weather Underground, just to name a few.
Re: Now available: AJAX/PHP multilingual website templates
Posted: Thu 06 Oct 2011 11:26 pm
by saratogaWX
Hi Ray,
Yes, I know about the forecast icon available in the realtime.txt, but it's not the same as a current conditions icon, so I chose not to use it for a dynamic AJAX update. The iconnumber for the current conditions is derived from the nearby METAR Sky/Weather report so is at most, one hour old, but it is an observation, not a forecast.
Best regards,
Ken
Re: Now available: AJAX/PHP multilingual website templates
Posted: Sat 08 Oct 2011 7:49 pm
by WX_Frank
I got a 'date/year' problem, and I'm totally stuck
Could you please have a look
in this thread please?
My site.
Thanks in advance
Frank.
Re: Now available: AJAX/PHP multilingual website templates
Posted: Sat 08 Oct 2011 8:35 pm
by saratogaWX
Hi,
Got the note and PM.. responded in
this thread.
Best regards,
Ken
Re: Now available: AJAX/PHP multilingual website templates
Posted: Thu 20 Oct 2011 9:12 pm
by elmdcw
Hi Ken,
I have created an alternative realtime.txt which includes the Davis forecast text (with spaces obviously). So I would like to parse my newrealtime.txt file (which has the variables separated by |)with a | character rather than a space. Is the ajaxCUwx.js easy to change to do this?
I changed the line
var realtime = x.responseText.split(' ');
to
var realtime = x.responseText.split('|');
without success.
Current test incarnation is here:
http://www.weather.btinternet.co.uk/testing/ajaxf.htm (indicator arrows for every change)
All help appreciated
Thanks
Dave
Re: Now available: AJAX/PHP multilingual website templates
Posted: Fri 21 Oct 2011 1:01 am
by beteljuice
Your test page currently is NOT using a | delimited file, nor is the scripted modified to parse |.
Neither the script nor the html have a forecast id allocated ?
All that aside .......
It would 'safer' to keep the '<space>' field seperator and replace the spaces in your forecast string(s) with _ (underscore).
In the ajax process loop you would need to add.
eg.
Code: Select all
var forecast = realtime[54].replace(/_/gm, ' ');
set_ajax_obs("ajaxforecast", forecast);
and in your html, modify to something like:
Code: Select all
....
<tr class="td_rainfall_data">
<td width="20%">Forecast</td>
<td width="80%"><span class="ajax" id="ajaxforecastnumber"></span> $nbsp;Davis forecast: <span class="ajax" id="ajaxforecast"></span></td>
</tr>
.....
However; be aware that with any Cumulus updates that add extra fields you will be 'stuck' with your personal forecastreatltime.txt and any future sarotoga script updates may not behave the way you expect !
Re: Now available: AJAX/PHP multilingual website templates
Posted: Fri 21 Oct 2011 1:19 am
by saratogaWX
Good advice, Beteljuice!
Another consideration is 'does the variable change often enough to warrant an AJAX update?'
Seems to me that forecasts change slowly enough that they should just be a part of the page (not AJAX enabled).
I always try to write pages that present complete data even if the browser has JavaScript disabled (and many browsers now do that), then offer the more frequent updates via JavaScript AJAX for variables that change frequently (or more often than the normal refresh time of the page).
YMMV
Best regards,
Ken
Re: Now available: AJAX/PHP multilingual website templates
Posted: Fri 21 Oct 2011 10:17 am
by elmdcw
Hi,
Just for a bit of fun, I am looking at "realtime"ing most of the cumulus data. The arrows on my page are updated every change rather than a trend arrow to give a more dynamic feel. Refreshing the page causes these to be reset, so I have tried to avoid that (maybe I can fix that). Having a mix of ajax and page refreshed data sometimes gives data conflicts (such as current ajaxapptemp being higher than apptemphigh which is relatively stale).
Will give your suggestions a whirl
Thanks
Dave
Re: Now available: AJAX/PHP multilingual website templates
Posted: Mon 24 Oct 2011 5:08 am
by WoodburyMan
I just applied the updates you made on Oct. 20th to my website. (Was up to date prior to that), including the template files for Cumulus itself. I am using 1.9.2 final (aka build 1017). Since the update, on my main page (
http://www.grudzien.us/index.php ) where it shows the brief forecast from NWS, it displays "Davis VP+ forecast: Not available" under the first items forecast. I have a Fine Offset station, and in Settings-weather.php I have the following set:
Code: Select all
$SITE['feelslike'] = 0; // =0 use HeatIndex, =1 use Humidex, =2 use Apparent Temperature
$SITE['DavisVP'] = false; // set to false if not a Davis VP weather station
$SITE['UV'] = false; // set to false if no UV sensor
$SITE['SOLAR'] = false; // set to false if no Solar sensor
Seems for some reason it started thinking I have a Davis station? Didn't display before the update and nothing else was changed.
Also.. you mentioned Build 1019 in the changelog. I don't see it anywhere listed on the site, yet at least.
Re: Now available: AJAX/PHP multilingual website templates
Posted: Mon 24 Oct 2011 5:33 am
by saratogaWX
Hi,
The 'Davis VP+ forecast: Not Available' displays because Cumulus is setting
Code: Select all
$WX['wsforecast'] = 'Not available';
You can suppress this message entirely by changing your index.php
Code: Select all
<?php if(isset($SITE['ajaxDashboard']) and file_exists($SITE['ajaxDashboard']))
{ include_once("ajax-dashboard.php");
to
Code: Select all
<?php if(isset($SITE['ajaxDashboard']) and file_exists($SITE['ajaxDashboard']))
{ $vpforecasttext = ''; include_once("ajax-dashboard.php");
Build 1019 was the last released build of 1.9.2 as indicated in
this posting.
Best regards,
Ken
Re: Now available: AJAX/PHP multilingual website templates
Posted: Mon 24 Oct 2011 12:27 pm
by WoodburyMan
Thanks! I'll edit it accordingly.
Do you think it's possible for future versions to add a conditional. Something like If $SITE['DavisVP'] = false; in settings-weather.php, then don't display VP forecast text?
Re: Now available: AJAX/PHP multilingual website templates
Posted: Fri 28 Oct 2011 6:31 am
by vpokroglo
Hello all,
I noticed a strange behaviour of function "Days since last rain". I think this is happening from one of the last updates of defs, tags file. The page is showing one day less, than it should be. So if it is raining on 26. 10. 2011, and today is 28. 10. 2011, there are 2 days, but my page shows "1 day since last rain.".
Another thing is, when is it raining the sentence is "0 day since last rain.". Im not soo good in English

, but i think it will be beter "0 days since last rain", or im wrong?
Thanks for any help!
Marko