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 4018) - 28 March 2024

Legacy Cumulus 1 release v1.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

Now available: AJAX/PHP multilingual website templates

Discussion of Ken True's web site templates

Moderator: saratogaWX

User avatar
saratogaWX
Posts: 1170
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 »

Sorry.. I was a bit confused. The tags I suggested removing are the

wdirdata|<#wdirdata>:|:
wspddata|<#wspddata>:|:

and the tag you mentioned

nextwindindex|<#nextwindindex>:|:

is a single number pointer into the comma-delimited arrays wdirdata/wspddata.

It is also not used in PHP or AJAX in the Cumulus AJAX/PHP template.
n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: Now available: AJAX/PHP multilingual website templates

Post by n9mfk »

Hi
Ken,
i do not have a solar or uv sensors
is there a way to to have the metar come up with day an night
Thanks beau
User avatar
saratogaWX
Posts: 1170
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 »

Yes, in your Settings-weather.php for Cumulus, there's an entry

Code: Select all

# Weather Station sensors and options for dashboard
$SITE['conditionsMETAR'] = 'KSJC';  // set to nearby METAR for current conditions icon/text
#  comment out conditionsMETAR if no nearby METAR.. conditions icon/text will not be displayed
#
$SITE['DavisVP']		= true;  // set to false if not a Davis VP weather station
$SITE['UV']				= true;  // set to false if no UV sensor
$SITE['SOLAR']			= true;  // set to false if no Solar sensor
Just set the $SITE['conditionsMETAR'] to the nearby METAR for you, and set

$SITE['UV'] = false; // set to false if no UV sensor
$SITE['SOLAR'] = false; // set to false if no Solar sensor

and that should do it.
Details at http://saratoga-weather.org/wxtemplates ... umulus.php
n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: Now available: AJAX/PHP multilingual website templates

Post by n9mfk »

Hi Ken,
i had it all set up what i was asking is can you have it say day or night
for example it reads Overcast if was day time could it say Overcast day or for night have Overcast night beau
User avatar
saratogaWX
Posts: 1170
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 »

Ahhh... Like WD says 'Night time/condition' during the night... right now, the code doesn't have that in there. The icon is set to a day or night icon depending on the local time v.s. sunrise/sunset, but the text is not changed.

A future project update will (hopefully) have a configurable method to not only do the 'Dawn/Dusk/Night time', but also display 'Windy' if wind average > a setting and try to use the rain gauge last-tip time + current rain rate to do the
'Dry/Drizzle/Light Rain/Moderate Rain/Heavy Rain' too. But.. that's an unscheduled future project :)
kinder
Posts: 38
Joined: Mon 08 Nov 2010 5:50 pm
Weather Station: DAVIS VANTAGE PRO 2
Operating System: Windows 7
Location: Nowhere

Re: Now available: AJAX/PHP multilingual website templates

Post by kinder »

i have setup everything as documented.I have put the whole structure in a directory named test,under my public_html folder,and point realtime.txt in config to the right filename (example ../logs/realtime.txt).I dont have cumulus web tags generated,but as i see there is an example file with test values.The problem is that all the 3 times i tried,i see a white empty page in almost every .php file.Is it something missing from php?I know that GD support is not enabled,but that should affect only graphs right?
User avatar
saratogaWX
Posts: 1170
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 »

kinder wrote:i have setup everything as documented.I have put the whole structure in a directory named test,under my public_html folder,and point realtime.txt in config to the right filename (example ../logs/realtime.txt).I dont have cumulus web tags generated,but as i see there is an example file with test values.The problem is that all the 3 times i tried,i see a white empty page in almost every .php file.Is it something missing from php?I know that GD support is not enabled,but that should affect only graphs right?
It would really help if you indicate the URL to your test website so I can have a look. Given your symptoms above, it's hard to say where the problem is without being to examine the site.

Best regards,
Ken
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:I understand that some code reduction can be obtained by combining the functions into common.php and that appeals to my aesthetic sense, but it would kill the ability to operate the scripts outside the template and force me into maintaining dual code bases in the future...
Ken, I cannot understand your thinking!

Let us take the example of someone is using the 'ajax-dashboard.php' script (or template) by itself without any other templates from the distribution package/set... In its present design/form, with a few basic setup, the 'ajax-dashboard.php' script (or template) can be used to display weather data on a web page with no additional file from the template package/set.

Now, how much more complicated or how much harder would it be if the user needed to download and use two (2) files instead of one, such as the 'ajax-dashboard.php' script and/plus the 'functions.php' script!

The 'functions.php' script would contain ALL of the functions that are presently spread and repeated throughout many templates/scripts. Not only that, one could download only the 'functions.php' script (without any other scripts or templates) and, using the functions available in that 'functions.php' script, one would be able to create a fully operational website.

For months, I have used a single function file/script with my Cumulus templates - all the functions have been moved out of all other scripts/templates to be concentrated into one single function file. If I find a new and interesting function, all I have to do is to edit the single function file. If the new function had been installed into a single template (as it is being done with the present day templates), it could not easily have been accessed by the other templates unless that new function was duplicated (copied over) into the other templates. Because the new function was installed into that single and dedicated function file, using the new function into 1 or 2 or 3 templates is as simple as adding a call to that function...

So, getting back to my example of someone using the 'ajax-dashboard.php' script (or template) by itself - that someone would now need to have two files, one 'ajax-dashboard.php' script containing the code to manage and display the weather data on a web page and one 'functions.php' script containing all (and more of) the code for the functions needed by the 'ajax-dashboard.php' script - so, I do not understand how the 'ajax-dashboard.php' script with its 'functions.php' script could not and would not remain operable outside the template set!

Since one of my modifications with the Cumulus and Weather Display template set has been the removal of the functions from the individual scripts and templates, I guess there is no need for me to supply you with modified scripts and/or templates as they will no longer be compatible with your designs...
User avatar
saratogaWX
Posts: 1170
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 »

Hmmm.... I'm having a sense of déjà vu with your discussion and the rationale as we'd had a similar conversation about the Bilingual templates a while back. At that time, I'd expressed a similar concern about modifying the supporting scripts such that it would require maintaining two different code bases, and I'd similarly declined to take on the extra work that would require me to do.

Programming is both an art and a science, and there is more than one way to accomplish pretty much anything needed. The maintainability of a code base does require it to keep to certain guidelines in order to minimize the effort to maintain it.
My scripts are designed for both standalone and within-template usage.

While having one (possibly large) include that contains all possible functions needed by any of the scripts is indeed a way of making smaller scripts and preventing function definition interference, I've found (based on many interactions with weather enthusiasts using the scripts) that they find it more understandable and easier to modify for their own purposes if the code includes the functions required so the script is self-contained. I've made a firm practice of being supportive to all who want to use my scripts and modify them for their own use, and that's another reason for my stance here.

As written, the ajax-dashboard and ajax-gizmo scripts internally use the Weather-Display $tagnames, so are usable in a standalone mode only with Weather-Display tags. The AJAX/PHP template set plugins (-defs.php file) provides the bridge that maps the variable names from the $WX[] array to the $tagnames needed for the dashboard/gizmo (along with using internal and external functions to populate the missing $tags, particularly for astronomical data and current conditions/Icon from a nearby METAR).

While I could see combining the common functions from the ajax-dashboard and ajax-gizmo into the common.php file (which is where the template sets all share functions), I'd like the other support scripts (ec-forecast, ec-radar, etc) to remain as standalone yet template aware (as they are now).

I would like to see your work and am especially interested in your mods to ec-radar such that the document-root is no longer needed.

Best regards,
Ken
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 »

I agree and support your broadbase philosophy Ken :clap:
Image
......................Imagine, what you will KNOW tomorrow !
n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: Now available: AJAX/PHP multilingual website templates

Post by n9mfk »

Hi Ken,
how can i get a space next to Wednesday an Wednesday Night

Code: Select all

<div id="main-copy">

         <!-- advforecast2.php - V2.17 - 08-Jan-2011 --> 
<!-- NWS URL: http://forecast.weather.gov/MapClick.php?CityName=Springfield&state=IL&site=ILX&textField1=39.7814&textField2=-89.6447&e=0&TextType=2 --> 
<!-- zone=ILZ051 --> 
<!-- loading forecast.txt --> 
  <table width="640" style="border: none;">

    <tr align="center" style="background-color: #FFFFFF;">

      <td><b>National Weather Service Forecast for: </b><span style="color: green;">

           Springfield IL</span><br />

        Issued by: National Weather Service Lincoln, IL      </td>

    </tr>

    <tr>

      <td align="center">Updated: 3:12 pm CST Feb 8, 2011          </td>

    </tr>

    <tr>

      <td align="center">&nbsp;

            <table width="100%" border="0" cellpadding="0" cellspacing="0">

              <tr valign ="top" align="center">

        <td style="width: 11%;"><span style="font-size: 8pt;"><b>Tonight<br /></b><br /><img src="forecast/images/nbkn.jpg" width="55" height="58" alt="Mostly Cloudy" title="Mostly Cloudy" /><br />Mostly<br />Cloudy</span></td> 
<td style="width: 11%;"><span style="font-size: 8pt;"><b>Wednesday<br /></b><br /><img src="forecast/images/bkn.jpg" width="55" height="58" alt="Partly Sunny" title="Partly Sunny" /><br />Partly<br />Sunny</span></td> 
<td style="width: 11%;"><span style="font-size: 8pt;"><b>Wednesday<br />Night</b><br /><img src="forecast/images/nfew.jpg" width="55" height="58" alt="Mostly Clear" title="Mostly Clear" /><br />Mostly<br />Clear</span></td> 
<td style="width: 11%;"><span style="font-size: 8pt;"><b>Thursday<br /></b><br /><img src="forecast/images/few.jpg" width="55" height="58" alt="Sunny" title="Sunny" /><br />Sunny<br /></span></td> 
<td style="width: 11%;"><span style="font-size: 8pt;"><b>Thursday<br />Night</b><br /><img src="forecast/images/nsct.jpg" width="55" height="58" alt="Partly Cloudy" title="Partly Cloudy" /><br />Partly<br />Cloudy</span></td> 
<td style="width: 11%;"><span style="font-size: 8pt;"><b>Friday<br /></b><br /><img src="forecast/images/sct.jpg" width="55" height="58" alt="Mostly Sunny" title="Mostly Sunny" /><br />Mostly<br />Sunny</span></td> 
<td style="width: 11%;"><span style="font-size: 8pt;"><b>Friday<br />Night</b><br /><img src="forecast/images/nsct.jpg" width="55" height="58" alt="Partly Cloudy" title="Partly Cloudy" /><br />Partly<br />Cloudy</span></td> 
<td style="width: 11%;"><span style="font-size: 8pt;"><b>Saturday<br /></b><br /><img src="forecast/images/sct.jpg" width="55" height="58" alt="Mostly Sunny" title="Mostly Sunny" /><br />Mostly<br />Sunny</span></td> 
<td style="width: 11%;"><span style="font-size: 8pt;"><b>Saturday<br />Night</b><br /><img src="forecast/images/nsct.jpg" width="55" height="58" alt="Partly Cloudy" title="Partly Cloudy" /><br />Partly<br />Cloudy</span></td> 
          </tr>

          <tr valign ="top" align="center">

          <td style="width: 11%;">Lo <span style="color: #0033CC;">3 &deg;F</span></td> 
<td style="width: 11%;">Hi <span style="color: #FF0000;">16 &deg;F</span></td> 
<td style="width: 11%;">Lo <span style="color: #0033CC;">2 &deg;F</span></td> 
<td style="width: 11%;"> 
Hi <span style="color: #FF0000;">19 &deg;F</span></td> 
<td style="width: 11%;">Lo <span style="color: #0033CC;">12 &deg;F</span></td> 
<td style="width: 11%;">Hi <span style="color: #FF0000;">29 &deg;F</span></td> 
<td style="width: 11%;">Lo <span style="color: #0033CC;">17 &deg;F</span></td> 
<td style="width: 11%;">Hi <span style="color: #FF0000;">37 &deg;F</span></td> 
<td style="width: 11%;">Lo <span style="color: #0033CC;">29 &deg;F</span></td> 
          </tr>

        </table>

     </td>

   </tr>

</table>

  <p><a href="http://www.weather.gov/showsigwx.php?warnzone=ILZ051&warncounty=ILC167&firewxzone=ILZ051&local_place1=Springfield+IL&product1=Hazardous+Weather+Outlook" target="_blank"><strong><span style="color: red">Hazardous Weather Outlook</span></strong></a><br/> 
&nbsp;</p>



<table style="border: 0" width="640">

        <tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Tonight</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Mostly cloudy, with a low around 3. Wind chill values between -3 and -8. West northwest wind around 7 mph. </td> 
</tr> 
<tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Wednesday</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Partly sunny, with a high near 16. Wind chill values between -9 and 1. West northwest wind between 7 and 10 mph. </td> 
</tr> 
<tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Wednesday Night</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Mostly clear, with a low around 2. Wind chill values between -5 and zero. West northwest wind between 5 and 7 mph. </td> 
</tr> 
<tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Thursday</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Sunny, with a high near 19. Wind chill values between -7 and 3. Southwest wind between 5 and 11 mph. </td> 
</tr> 
<tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Thursday Night</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Partly cloudy, with a low around 12. West southwest wind around 10 mph. </td> 
</tr> 
<tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Friday</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Mostly sunny, with a high near 29.  </td> 
</tr> 
<tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Friday Night</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Partly cloudy, with a low around 17.  </td> 
</tr> 
<tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Saturday</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Mostly sunny, with a high near 37.  </td> 
</tr> 
<tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Saturday Night</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Partly cloudy, with a low around 29.  </td> 
</tr> 
<tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Sunday</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Mostly sunny, with a high near 42.  </td> 
</tr> 
<tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Sunday Night</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Partly cloudy, with a low around 33.  </td> 
</tr> 
<tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Monday</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Mostly sunny, with a high near 43.  </td> 
</tr> 
<tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Monday Night</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Partly cloudy, with a low around 24.  </td> 
</tr> 
<tr valign ="top" align="left"> 
<td style="width: 20%;"><b>Tuesday</b><br />&nbsp;<br /></td> 
<td style="width: 80%;">Sunny, with a high near 39.  </td> 
</tr> 
   </table>



<p>&nbsp;</p>

<p>Forecast from <a href="http://forecast.weather.gov/MapClick.php?CityName=Springfield&state=IL&site=ILX&textField1=39.7814&textField2=-89.6447&e=0&TextType=2">NOAA-NWS</a>

for Springfield IL. </p>



</div><!-- end main-copy -->

Beau
You do not have the required permissions to view the files attached to this post.
User avatar
saratogaWX
Posts: 1170
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 »

beteljuice wrote:I agree and support your broadbase philosophy Ken :clap:
Thanks beteljuice :D

Beau,
The spacing is limited by the

Code: Select all

<table style="border: 0" width="640">
used twice in the advforecast2.php script. If you're using the wide-screen aspect, then changing the two occurrences of that to something like

Code: Select all

<table style="border: 0" width="700">
would allow the tables to 'relax' and spread out the icons/legends a bit more.
It wouldn't help in the narrow-screen style as there is really only about 620px for display in the 800px wide narrow style.

Best regards,
Ken
kinder
Posts: 38
Joined: Mon 08 Nov 2010 5:50 pm
Weather Station: DAVIS VANTAGE PRO 2
Operating System: Windows 7
Location: Nowhere

Re: Now available: AJAX/PHP multilingual website templates

Post by kinder »

i will do that tonight.Is there any more complicated php script to check all functions that this template require to run?>
User avatar
saratogaWX
Posts: 1170
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 »

kinder wrote:i will do that tonight.Is there any more complicated php script to check all functions that this template require to run?>
Sadly, no .. there isn't a diagnostic script to make sure all the stuff is set correctly for the site to operate normally.

Each page may have diagnostic info in it (especially if it includes support scripts) as HTML comments so you can see 'what's going on'. All the wx....php pages will accept a ?debug=y to have the scripts spit out a lot of extra info (but screw up the page layout in the process.. can't be helped).
See: http://saratoga-weather.org/wxtemplates/maint.php for more info.

There is also a undocumented (but supplied with the template) check-fetch-times.php script that will try all the URLs you've configured for forecasts and advisories and report on the time it takes to do that.. useful for debugging connectivity programs.

The main test will be you, going to each page on your site, and seeing if it looks as expected, and if not, use the tips above to dig in to debug it :)

Hope this helps...
Best regards,
Ken
kinder
Posts: 38
Joined: Mon 08 Nov 2010 5:50 pm
Weather Station: DAVIS VANTAGE PRO 2
Operating System: Windows 7
Location: Nowhere

Re: Now available: AJAX/PHP multilingual website templates

Post by kinder »

sent a pm with the link to you.
Post Reply