Welcome to the Cumulus Support forum.

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

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 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

Ajax/PHP Intigration Small Issue

Discussion of Mark Crossley's HTML5/Javascript gauges

Moderator: mcrossley

Post Reply
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:

Ajax/PHP Intigration Small Issue

Post by WoodburyMan »

Greetings!

First off thank you thank you thank you for your creation. You've done an amazing job! It's a great script!

I managed to integrate this into Saratoga Weather's Ajax/Php weather site by changing the extension to .php and adding Satatog's header and footer's into the file. To get it to work properly the only real problem I ran into was having to comment out a style sheet line on the original page so that the rest of the page maintained Saratoga's fonts and sizes. The only other major mod was just deleting the UV and Radiation gauges from the file, even though I have it disabled in the config file, just to simplify things.

Here is my page with the Gauges.
http://www.grudzien.us/gauges-ss.php


However I have one odd issue. On the page, wherever the unit ° is used (Any temperature setting, or wind direction) it displays "°F" or "°" for wind direction. It does this on the gauges themselves as well as the hover-over cumulus graphs that it displays. It does this in Firefox, Chrome, Safari and IE on Windows, Mac OSX 10.7 and Ubuntu. I have also tested this with the css file i had commented out re-enabled and it still does the same thing. This does not occur in the HTM original unmodified version on only in my modified PHP version.

I have also attached my gauges-ssT.php file that Cumulus processes for reference as well.

Here is a unmodified stock template file also running on my site for reference.
http://www.grudzien.us/gauges-ss.htm

I am absolutely no expert as css/html/php/javascript. Enough to be dangerous more or less. Quite frankly I'm surprised I managed to get the page look as nice as it is and still work. If there is anything you can do to point me in the correct direction I would greatly appreciate it. I understand this is not a problem with your gauges at all since they work perfectly on there own, but a result of my botching Saratoga and your script together.
You do not have the required permissions to view the files attached to this post.
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
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: Ajax/PHP Intigration Small Issue

Post by beteljuice »

This looks like one of those nasty charsets / save as / no server char header conflicts, that keep cropping up nowadays - even on the bigboys sites.

In the <head> you have declared charset as ISO-8859-1, but lower down in the body you have a <META tag which tries to make it UTF-8 ?

No doubt Mark will be around later !
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Ajax/PHP Intigration Small Issue

Post by mcrossley »

Hi, there are a number of 'issues' integrating the SS gauges with the Saratoga templates.

First off is that the Saratoga templates are written to use charset=ISO-8859-1, and the gauges UTF-8.

Secondly is the Saratoga templates are written in XHTML 1.0 Transitional, and the gauges in HTML5. (Your "Valid XHTML 1.0" is not true for that page).

...and you have possibly introduced a third 'issue' in that it looks like the script files when they were edited were not saved back in their original UTF-8 format - though it is hard to tell without access to the original files, the web server may alter them to fit ISO-8859-1.

As beteljuice has pointed out you also have a <meta> tag with a conflicting UTF-8 (and other META's) in the body on the page for the gauges rather than in the header where they belong.

Now, given the gauges have to be HTML5 as they use new HTML5 features...

The 'proper' fix (which some people on the WD forum have done) is to create new versions of the Saratoga header/footer that are also in HTML5/UTF-8 format (UTF-8 is the default character set for HTML5) just for the gauges page. Then you will have a fully HTML5/UTF-8 page which will pass validation.

Another possible solution is to place the gauges in a frame within the page, the frame can then be pure HTML5.

Or you can try editing the gauges.js file, converting it to ISO-8859-1, fixing the degree and superscript characters (if you ever use Sol. rad.) and saving in that format. It may work, I haven't tried it, it depends on how the <canvas> elements handle text encodings.
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: Ajax/PHP Intigration Small Issue

Post by WoodburyMan »

Thanks Mark and beteljuice!

I took the quick route and simply made a frame. I used a regular Saratoga header and footer and just placed a iframe with the regular original gauge-ss.htm as the source and made it seamless and it does the job! Thanks again!

CSS validation passes fine, and XHTML validation passes for the most part besides some errors I have from my footer with my paypal donate button that have lingered for a while I have yet to fix.

Do you have a donation page set up anywhere? I've given both Steve and Saratoga some beer money and I would certainly love to send some your way for your work.
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
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Ajax/PHP Intigration Small Issue

Post by mcrossley »

No donate page for the gauges, just buy me a beer next time you see me :lol:
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: Ajax/PHP Intigration Small Issue

Post by WoodburyMan »

Image
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
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: Ajax/PHP Intigration Small Issue

Post by WoodburyMan »

I kept having to play around recently to get the border's to work correctly. My prev fix worked on most desktop and iPhone 4S in Safari, but recently started running Chrome on both my ICS Tablet and iPhone 4S and had placement issues. Contents of my gauges.php file that includes a bone stock gauges-ss.htm file is as follows and works perfectly on all devices aligned perfectly.

Code: Select all

<?php
############################################################################
# A Project of TNET Services, Inc. and Saratoga-Weather.org (WD-USA template set)
############################################################################
#
#   Project:    Sample Included Website Design
#   Module:     sample.php
#   Purpose:    Sample Page
#   Authors:    Kevin W. Reed <kreed@tnet.com>
#               TNET Services, Inc.
#
# 	Copyright:	(c) 1992-2007 Copyright TNET Services, Inc.
############################################################################
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
############################################################################
#	This document uses Tab 4 Settings
############################################################################
require_once("Settings.php");
require_once("common.php");
############################################################################
$TITLE= $SITE['organ'] . " - Gauges";
$showGizmo = true;  // set to false to exclude the gizmo
include("top.php");
############################################################################
?>
</head>
<body>
<?php
############################################################################
include("header.php");
############################################################################
include("menubar.php");
############################################################################
?>
<div id="main-copy">
<!-- Start Original -->
<iframe src="gauges-ss.htm" name="gaugeframe" frameborder=”0″ allowfullscreen scrolling="no" marginwidth="0" marginheight="0" frameborder="0" height="900" width="735">You need a Frames Capable browser to view this content.</iframe> 
</div><!-- end main-copy -->

<?php
############################################################################
include("footer.php");
############################################################################
# End of Page
############################################################################
?>
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
Post Reply