Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

Now available: AJAX/PHP multilingual website templates

Discussion of Ken True's web site templates

Moderator: saratogaWX

User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post 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 ...
User avatar
saratogaWX
Posts: 1238
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post 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
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post by nitrx »

Aha well I've to do something tommorow thanks for explaining :!:
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Now available: AJAX/PHP multilingual website templates

Post 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.
User avatar
saratogaWX
Posts: 1238
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post 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
WX_Frank
Posts: 82
Joined: Sun 24 Jul 2011 9:12 am
Weather Station: Davis Vantage Vue
Operating System: Win7
Location: Torrevieja/Spain
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post 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.
User avatar
saratogaWX
Posts: 1238
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post by saratogaWX »

Hi,
Got the note and PM.. responded in this thread.

Best regards,
Ken
elmdcw
Posts: 21
Joined: Wed 12 Jan 2011 9:45 am
Weather Station: VP2
Operating System: W7
Location: Ruislip

Re: Now available: AJAX/PHP multilingual website templates

Post 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
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Now available: AJAX/PHP multilingual website templates

Post 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;$nbsp;Davis forecast:&nbsp;<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 !
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
saratogaWX
Posts: 1238
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post 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
elmdcw
Posts: 21
Joined: Wed 12 Jan 2011 9:45 am
Weather Station: VP2
Operating System: W7
Location: Ruislip

Re: Now available: AJAX/PHP multilingual website templates

Post 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
WoodburyMan
Posts: 166
Joined: Sun 04 Sep 2011 2:02 am
Weather Station: Ecowitt GW1000
Operating System: Windows 10 20H2
Location: Woodbury, Connecticut, U.S.A.
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post 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.
Woodbury, CT Weather Ecowitt GW1100, Solar, Wind, Rain, Temp, Soil, Lightning
Southington, CT Weather Ecowitt GW2000 Wittboy Solar, Wind, Rain, Temp, Soil, Lightning, CO2/PM2.5/PM10

Running CumuluxMX 3.24.1 b3234 both sites on Windows 11 22H2
User avatar
saratogaWX
Posts: 1238
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post 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
WoodburyMan
Posts: 166
Joined: Sun 04 Sep 2011 2:02 am
Weather Station: Ecowitt GW1000
Operating System: Windows 10 20H2
Location: Woodbury, Connecticut, U.S.A.
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post 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?
Woodbury, CT Weather Ecowitt GW1100, Solar, Wind, Rain, Temp, Soil, Lightning
Southington, CT Weather Ecowitt GW2000 Wittboy Solar, Wind, Rain, Temp, Soil, Lightning, CO2/PM2.5/PM10

Running CumuluxMX 3.24.1 b3234 both sites on Windows 11 22H2
User avatar
vpokroglo
Posts: 111
Joined: Thu 24 Feb 2011 7:45 pm
Weather Station: WS-2350
Operating System: Raspberry Pi 2
Location: Slovenija
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post 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? :oops:

Thanks for any help!

Marko
Image
Post Reply