Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.0.1 (build 4023) - 16 May 2024

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

Now available: AJAX/PHP multilingual website templates

Discussion of Ken True's web site templates

Moderator: saratogaWX

Post Reply
User avatar
PaulMy
Posts: 3878
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post by PaulMy »

Thanks nitrx,
I experimented that way and got text and data but haven't figured out yet how to get the columns to line up, let alone how to put separate text and data on the same line. :bash:

Paul
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// komokaweather.com/cumulusmx4/index.htm
Image
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 »

PaulMy wrote:Thanks nitrx,
I experimented that way and got text and data but haven't figured out yet how to get the columns to line up, let alone how to put separate text and data on the same line. :bash:

Paul
Well for your 'record's (recordT.htm data simple cut/paste

Code: Select all

<p>Recorden vanaf <#recordsbegandate>. Hier zijn de extremen vanaf.</p>
<table width="100%" cellpadding="0" cellspacing="0" id="Current_Weather_Records">
   <caption>Recorden vanaf <#recordsbegandate></caption>
  <tr>
    <td colspan="3" class="tableseparator_temp">Temperatuur en Rel. Luchtvochtigheid</td>
  </tr>
  <tr class="td_temperature_data">
    <td class="main_table_text_labels">Hoogste Temperatuur</td>
    <td class="right_align_indented"><#tempH> <#tempunit></td>
    <td class="right_align_indented"><#TtempH format="'om' hh:nn 'op' dd mmmm yyyy"></td>
  </tr>
  <tr class="td_temperature_data">
    <td class="main_table_text_labels">Laagste Temperatuur</td>
    <td class="right_align_indented"><#tempL>&nbsp;<#tempunit></td>
    <td class="right_align_indented"><#TtempL format="'om' hh:nn 'op' dd mmmm yyyy"></td>
  </tr>
  <tr class="td_temperature_data">
    <td class="main_table_text_labels">Laagste Wind chill</td>
    <td class="right_align_indented"><#wchillH>&nbsp;<#tempunit></td>
    <td class="right_align_indented"><#TwchillH format="'om' hh:nn 'op' dd mmmm yyyy"></td>
  </tr>
  <tr class="td_temperature_data">
    <td class="main_table_text_labels">Hoogste Minimum Temperatuur</td>
    <td class="right_align_indented"><#mintempH>&nbsp;<#tempunit></td>
    <td class="right_align_indented"><#TmintempH format="'op' dd mmmm yyyy"></td>
  </tr>
  <tr class="td_temperature_data">
    <td class="main_table_text_labels">Laagste Maximum Temperatuur</td>
    <td class="right_align_indented"><#maxtempL>&nbsp;<#tempunit></td>
    <td class="right_align_indented"><#TmaxtempL format="'op' dd mmmm yyyy"></td>
  </tr>
  <tr>
    <td colspan="3" class="tableseparator_rainfall">Neerslag</td>
  </tr>
  <tr class="td_rainfall_data">
    <td class="main_table_text_labels">Hoogste neerslagintensiteit per uur</td>
    <td class="right_align_indented"><#rrateM>&nbsp;<#rainunit>/hr</td>
    <td class="right_align_indented"><#TrrateM format="'om' hh:nn 'op' dd mmmm yyyy"></td>
  </tr>
  <tr class="td_rainfall_data">
    <td class="main_table_text_labels">Hoogste neerslag per uur</td>
    <td class="right_align_indented"><#rfallhH>&nbsp;<#rainunit></td>
    <td class="right_align_indented"><#TrfallhH format="'om' hh:nn 'op' dd mmmm yyyy"></td>
  </tr>
  <tr class="td_rainfall_data">
    <td class="main_table_text_labels">Hoogste dagelijkse neerslag</td>
    <td class="right_align_indented"><#rfallH>&nbsp;<#rainunit></td>
    <td class="right_align_indented"><#TrfallH format="'om' hh:nn 'op' dd mmmm yyyy"></td>
  </tr>
  <tr class="td_rainfall_data">
    <td class="main_table_text_labels">Hoogste maandelijkse neerslag</td>
    <td class="right_align_indented"><#rfallmH>&nbsp;<#rainunit></td>
    <td class="right_align_indented"><#TrfallmH format="'over' mmmm yyyy"></td>
  </tr>
  <tr>
    <td colspan="3" class="tableseparator_wind">Wind</td>
  </tr>
  <tr class="td_wind_data">
    <td class="main_table_text_labels">Hoogste windvlaag</td>
    <td class="right_align_indented"><#gustM>&nbsp;<#windunit></td>
    <td class="right_align_indented"><#TgustM format="'om' hh:nn 'op' dd mmmm yyyy"></td>
  </tr>
  <tr class="td_wind_data">
    <td class="main_table_text_labels">Hoogste Windsnelheid</td>
    <td class="right_align_indented"><#wspeedH>&nbsp;<#windunit></td>
    <td class="right_align_indented"><#TwspeedH format="'om' hh:nn 'op' dd mmmm yyyy"></td>
  </tr>
  <tr>
    <td colspan="3" class="tableseparator_pressure">Luchtdruk op zee niveau</td>
  </tr>
  <tr class="td_pressure_data">
    <td class="main_table_text_labels">Laagste Luchtdruk</td>
    <td class="right_align_indented"><#pressL>&nbsp;<#pressunit></td>
    <td class="right_align_indented"><#TpressL format="'om' hh:nn 'op' dd mmmm yyyy"></td>
  </tr>
  <tr class="td_pressure_data">
    <td class="main_table_text_labels">Hoogste Luchtdruk</td>
    <td class="right_align_indented"><#pressH>&nbsp;<#pressunit></td>
    <td class="right_align_indented"><#TpressH format="'om' hh:nn 'op' dd mmmm yyyy"></td>
  </tr>
  </table>
Notice you have to to change some code like the hours and date parameters and not use my language :) past it in a php file the code above can be marked up with some simple html code's like <b>for bold</b> headers <i>italalics</i> and even some color if you wish
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 »

Ken
line 515 of ajax-dashboard b reads

Code: Select all

<?php langtrans('Gust Month'); ?>: <?php echo $mrecordwindgust. " $uomWind"; ?>
in all v2 dashboard do not have the

Code: Select all

. " $uomWind"
Beau
User avatar
PaulMy
Posts: 3878
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post by PaulMy »

Thanks nitrx,
Well for your 'record's (recordT.htm data simple cut/paste
I tried that with the Cumulus tags but found I needed to use the php tags provided in Ken's template and that is where I got into deep trouble.
and not use my language
Maybe I should leave it your language so I can refresh my Vlaams :lol:
Paul
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// komokaweather.com/cumulusmx4/index.htm
Image
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 »

nitrx wrote:Well for your 'record's (recordT.htm data simple cut/paste
Ron, Paul cannot just cut-and-paste the code as the templates are not processed by Cumulus - meaning the Cumulus tags will not be added.

Paul must first edit Ken's 'CUtags.txt' (or 'CUtags-comments.txt') to include the tags needed for the record page (using 'recordT.htm" as a guide). Paul then has to use Ken's 'gen-CUtags.php' script to create 'CUtags.php' which should then be renamed 'CUtagsT.htm' and be processed by Cumulus to add the data to the new tags.

Second, Paul must then edit Ken's 'CU-defs.php' to include the new tags. There is a syntax to follow:
- the syntax used in the 'CUtagsT.txt' file was:

Code: Select all

tempH|<#tempH>:|:
- the syntax to be used in the 'CU-defs.php' file should be:

Code: Select all

$tempH = $WX['tempH'];
Then the tags required for the new page are available... Paul must first make a copy of the template 'wxnewpage.php' to something such as 'wxrecords.php'. Now, Paul can copy-and-paste the code from the 'recordT.htm' into the new 'wxrecords.php' template remembering to replace all the '<#webtag>' - using the above tag, the '<#tempH>' must be replaced with '<?php echo $tempH; ?>', such as:

Code: Select all

<td class="right_align_indented"><#tempH> <#tempunit></td>

Code: Select all

<td class="right_align_indented"><?php echo $tempH . '&nbsp;' . $uomtemp; ?></td>
You see, that was easy... :mrgreen:
User avatar
saratogaWX
Posts: 1211
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 »

I can see there is some confusion on how you can add a page with native Cumulus variables on the page, so I've generated an example (attached) of the port of the recordsT.htm template so you can see how it can be done.

In short:
1) you should never have to upload a PHP page with embedded Cumulus <#variableName> markup .. all the available Cumulus tags are available in PHP through the upload of CUtags.txt->CUtags.php and are useable as

Code: Select all

<?php print $WX['variableName']; ?>
.
2) You don't need to mess with the CU-defs.php file at all to add any $variableName equates as Ray suggested .. the CU-defs.php file should remain unmodified as it may be replaced in new distributions as new variables corresponding to tags used in the ajax-dashboard become available.
So.. please, don't modify the CU-defs.php file .. let me do that with new distributions.
3) when making a new page, do copy wxnewpage.php in your site to a new name and modify the copied page. Repeat as needed for each new page.
4) Use the built-in functions to provide multilanguage compatiblity. Instead of using something like

Code: Select all

<td>Temperature</td>
use

Code: Select all

<td><?php langtrans('Temperature'); ?></td>
which will return the text for the language selected. All the page markups should be in English and the translation done in a corresponding language-LL.txt file with langlookup|<english>|<language>| entries
For example, the attached page just needs the following items translated

Code: Select all

langlookup|Records began on|Records began on|
langlookup|Here are the extremes recorded since then|Here are the extremes recorded since then|
langlookup|Records Since|Records Since|
langlookup|Highest|Highest|
langlookup|Lowest|Lowest|
langlookup|Wind Chill|Wind Chill|
langlookup|Minimum|Minimum|
langlookup|Maximum|Maximum|
langlookup|Rainfall|Rainfall|
langlookup|Hourly Rainfall|Hourly Rainfall|
langlookup|Daily Rainfall|Daily Rainfall|
langlookup|Monthly Rainfall|Monthly Rainfall|
langlookup|Wind Gust|Wind Gust|
langlookup|Wind Speed Average|Wind Speed Average|
Replace the second English phrase in each line with the targeted language's phrase, and you're done :)

Using your sample above, Ron, I surmise the Dutch translations would be

Code: Select all

langlookup|Records began on|Recorden vanaf|
langlookup|Here are the extremes recorded since then|Hier zijn de extremen vanaf|
langlookup|Records Since|Recorden vanaf|
langlookup|Highest|Hoogste|
langlookup|Lowest|Laagste|
langlookup|Wind Chill|Wind Chill|
langlookup|Minimum|Minimum|
langlookup|Maximum|Maximum|
langlookup|Rainfall|Neerslag|
langlookup|Hourly Rainfall|neerslag per uur|
langlookup|Daily Rainfall|dagelijkse neerslag|
langlookup|Monthly Rainfall|maandelijkse neerslag|
langlookup|Wind Gust|windvlaag|
langlookup|Wind Speed Average|Windsnelheid|
You can see a sample of the page with the above Dutch translation active at http://saratoga-weather.org/wxtemplates ... hp?lang=nl

I'm not trying to say this is the only way to add new pages with native Cumulus data, and you are free to do as you wish. The suggested method above has several advantages:
1) it is easier on you long-term
2) it keeps your template system maintainable for future updates
3) it lets you easily offer translations
4) it presents the UOM and date/time format as you specified in the Settings.php
5) it avoids unnecessary uploads by leveraging the single CUtags.php for ALL the Cumulus data available

I hope this helps... enjoy the new wxcurecords.php page

Best regards,
Ken
You do not have the required permissions to view the files attached to this post.
Last edited by saratogaWX on Mon 21 Feb 2011 6:32 am, edited 2 times in total.
User avatar
saratogaWX
Posts: 1211
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 »

n9mfk wrote:Ken
line 515 of ajax-dashboard b reads

Code: Select all

<?php langtrans('Gust Month'); ?>: <?php echo $mrecordwindgust. " $uomWind"; ?>
in all v2 dashboard do not have the

Code: Select all

. " $uomWind"
Beau
Ummm.. not quite. The ajax-dashboard has

Code: Select all

$uomWind = ' mph';
...
if (isset($SITE['uomWind'])) 	{$uomWind = $SITE['uomWind'];}
So your $SITE['uomWind'] setting in Settings.php determines the units to display.
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 »

saratogaWX wrote: I'm not trying to say this is the only way to add new pages with native Cumulus data, and you are free to do as you wish. The suggested method above has several advantages:
1) it is easier on you long-term
2) it keeps your template system maintainable for future updates
3) it lets you easily offer translations
4) it presents the UOM and date/time format as you specified in the Settings.php
5) it avoids unnecessary uploads by leveraging the single CUtags.php for ALL the Cumulus data available

I hope this helps... enjoy the new wxcurecords.php page

Best regards,
Ken
Thanks Ken, I understand the advantages (allthough it's all very complicated to me) but it seems the date and time functions will give strange figures I get data in the seventies http://www.apeldoorn.tk/weer/wxcurecords.php compared to my 'real' data http://www.apeldoorn.tk/weer/wxlinks.php , I'll try to do some other pages this week like today and yesterdayT.htm :geek:

Thanks,
Ron
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 think i was clear in my last post
on line 515 if you look st the image it reads Gust Month: 34.0 mph Feb 01
most v2 ajax-dashboard read Gust Month: 34.0 Feb 01
so i was ask to have the mph removed on that 1 line
Beau
You do not have the required permissions to view the files attached to this post.
User avatar
saratogaWX
Posts: 1211
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 »

nitrx wrote:
saratogaWX wrote: I'm not trying to say this is the only way to add new pages with native Cumulus data, and you are free to do as you wish. The suggested method above has several advantages:
1) it is easier on you long-term
2) it keeps your template system maintainable for future updates
3) it lets you easily offer translations
4) it presents the UOM and date/time format as you specified in the Settings.php
5) it avoids unnecessary uploads by leveraging the single CUtags.php for ALL the Cumulus data available

I hope this helps... enjoy the new wxcurecords.php page

Best regards,
Ken
Thanks Ken, I understand the advantages (allthough it's all very complicated to me) but it seems the date and time functions will give strange figures I get data in the seventies http://www.apeldoorn.tk/weer/wxcurecords.php compared to my 'real' data http://www.apeldoorn.tk/weer/wxlinks.php , I'll try to do some other pages this week like today and yesterdayT.htm :geek:

Thanks,
Ron
Hi Ron,
I've done an update to the wxcurecords.php page to add additional processing in the date areas. I forgot that I needed to convert the <i>dd month yyyy</i> where month was in Dutch to english for processing by strtotime(). I borrowed a bit of that function from the wxastronomy.php page, so now the months display as they should.

Best regards,
Ken
You do not have the required permissions to view the files attached to this post.
Last edited by saratogaWX on Mon 21 Feb 2011 6:10 pm, edited 1 time in total.
User avatar
saratogaWX
Posts: 1211
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 »

n9mfk wrote:Hi Ken,
I do not think i was clear in my last post
on line 515 if you look st the image it reads Gust Month: 34.0 mph Feb 01
most v2 ajax-dashboard read Gust Month: 34.0 Feb 01
so i was ask to have the mph removed on that 1 line
Beau
Ahh... I didn't really understand your first question correctly.

You can change

Code: Select all

<?php langtrans('Gust Month'); ?>: <?php echo $mrecordwindgust. " $uomWind"; ?>
to

Code: Select all

<?php langtrans('Gust Month'); ?>: <?php echo $mrecordwindgust; ?>
to just remove the wind UOM display.
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 »

Thanks Ken,
will you be adding that change to the v3 ajax-dashboard.php
Beau
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 »

saratogaWX wrote: I've done an update to the wxcurecords.php page to add additional processing in the date areas. I forgot that I needed to convert the <i>dd month yyyy</i> where month was in Dutch to english for processing by strtotime(). I borrowed a bit of that function from the wxastronomy.php page, so now the months display as they should.

Best regards,
Ken
Great that does the job :D
Thanks,
Ron
User avatar
PaulMy
Posts: 3878
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Now available: AJAX/PHP multilingual website templates

Post by PaulMy »

can see there is some confusion on how you can add a page with native Cumulus variables on the page, so I've generated an example (attached) of the port of the recordsT.htm template so you can see how it can be done.

In short:
1) you should never have to upload a PHP page with embedded Cumulus <#variableName> markup .. all the available Cumulus tags are available in PHP through the upload of CUtags.txt->CUtags.php and are useable as
Thanks Ken,
I had learned what needs to be done just not familiar enough yet with php to get the right results (got the data - high temp, date and time, etc. to show but all on different lines) so took the simple way that I could handle for the time being. I will look at wxcurecords.zip and work on it further so it will continue when the ajax/php templates replaces my existing.

On another matter, I have looked but without success, where would I remove the text "The WXSIM forecast is not currently available." that is displayed on the Home page below the local Radar?

Then on to changing the top header with some images/graphics, text, etc. before the changeover. It has been a great learning experience.

Paul
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// komokaweather.com/cumulusmx4/index.htm
Image
User avatar
saratogaWX
Posts: 1211
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 »

PaulMy wrote:
can see there is some confusion on how you can add a page with native Cumulus variables on the page, so I've generated an example (attached) of the port of the recordsT.htm template so you can see how it can be done.

In short:
1) you should never have to upload a PHP page with embedded Cumulus <#variableName> markup .. all the available Cumulus tags are available in PHP through the upload of CUtags.txt->CUtags.php and are useable as
Thanks Ken,
I had learned what needs to be done just not familiar enough yet with php to get the right results (got the data - high temp, date and time, etc. to show but all on different lines) so took the simple way that I could handle for the time being. I will look at wxcurecords.zip and work on it further so it will continue when the ajax/php templates replaces my existing.

On another matter, I have looked but without success, where would I remove the text "The WXSIM forecast is not currently available." that is displayed on the Home page below the local Radar?

Then on to changing the top header with some images/graphics, text, etc. before the changeover. It has been a great learning experience.

Paul
Hi Paul,
I'm pleased you've found it a great learning experience :)

For the WXSIM message, you just have to change in Settings.php

Code: Select all

$SITE['WXSIM']			= true;  // Set to false if no WXSIM/plaintext-parser.php
to

Code: Select all

$SITE['WXSIM']			= false;  // Set to false if no WXSIM/plaintext-parser.php
and WXSIM will pester you no more :)

Best regards,
Ken
Post Reply