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

Webtags in PHP

From build 3044 the development baton passed to Mark Crossley. Mark has been responsible for all the Builds since. He has made the code available on GitHub. It is Mark's hope that others will join in this development, but at the very least he welcomes your ideas for future developments (see Cumulus MX Development suggestions).

Moderator: mcrossley

Post Reply
CumulusBat
Posts: 7
Joined: Thu 25 Aug 2022 7:24 pm
Weather Station: Davis Vantage Pro
Operating System: Windows 10

Webtags in PHP

Post by CumulusBat »

Hi!

In the previous version of cumulus (1.9.4), I could write this to assign a pressure variable with a php variable.

<?php
$p = '<#press>';
echo $p;
?>

Now, if I do the same with Cumulusmx, I get this:

<#press>

My page with CumulusMx is already indexed in php.

So what should I write?
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Webtags in PHP

Post by mcrossley »

The use of web tags in MX is no different from C1.

I think you will have to explain what you are doing in a bit more detail.

It looks like you are not getting MX to process the file.
Big Daddy
Posts: 270
Joined: Tue 10 Sep 2013 8:40 pm
Weather Station: Ecowitt GW1000 / various sensors
Operating System: Raspbian 12 Bookworm (X64)
Location: Freiston, Lincolnshire, UK
Contact:

Re: Webtags in PHP

Post by Big Daddy »

Do you need double quote instead of single

<?php
$p = "<#press>";
echo $p;
?>

My site is based one of Jacques DesRoches's (Weather By You) web site templates and it uses a file thats processed in Cumulus which converts webtags to php variables. It was originally used in Cumulus 1.9.4 and it has the following format, as an example

$RelPress = "<#press>";
$presstrendval = "<#presstrendval>";
$presstrend = "<#presstrend>";

The webtag has to be "processed" by Cumulus in the Extra Web Files (Under Settings) in Cumulus to convert it to a PHP variable I believe.

I converted this one to use the new formatting in MX

Andy
You do not have the required permissions to view the files attached to this post.
CumulusBat
Posts: 7
Joined: Thu 25 Aug 2022 7:24 pm
Weather Station: Davis Vantage Pro
Operating System: Windows 10

Re: Webtags in PHP

Post by CumulusBat »

mcrossley wrote: Thu 25 Aug 2022 7:49 pm The use of web tags in MX is no different from C1.

I think you will have to explain what you are doing in a bit more detail.

It looks like you are not getting MX to process the file.
I use the CumulusMx templates by Neil Thomas.

I can run a php script in my page. Example, the sun meridian time.

I live in Canada and I don't want to display the heat index in winter and the wind chill in summer.

So by having the temperature in a php variable I could write a script as needed.

I tried this script:
<?php
$p = "<#temp>";
echo $p;
?>
and I get this:
<#temp>
CumulusBat
Posts: 7
Joined: Thu 25 Aug 2022 7:24 pm
Weather Station: Davis Vantage Pro
Operating System: Windows 10

Re: Webtags in PHP

Post by CumulusBat »

Big Daddy wrote: Thu 25 Aug 2022 8:01 pm Do you need double quote instead of single

<?php
$p = "<#press>";
echo $p;
?>

My site is based one of Jacques DesRoches's (Weather By You) web site templates and it uses a file thats processed in Cumulus which converts webtags to php variables. It was originally used in Cumulus 1.9.4 and it has the following format, as an example

$RelPress = "<#press>";
$presstrendval = "<#presstrendval>";
$presstrend = "<#presstrend>";

The webtag has to be "processed" by Cumulus in the Extra Web Files (Under Settings) in Cumulus to convert it to a PHP variable I believe.

I converted this one to use the new formatting in MX

Andy
I do not understand well.

Where do you put this file (wt_data_inc.php) ?
Big Daddy
Posts: 270
Joined: Tue 10 Sep 2013 8:40 pm
Weather Station: Ecowitt GW1000 / various sensors
Operating System: Raspbian 12 Bookworm (X64)
Location: Freiston, Lincolnshire, UK
Contact:

Re: Webtags in PHP

Post by Big Daddy »

The file can go anywhere. I put mine in the CumulusMX root folder.

In Extra Web Files, fill in where the above file is and where you want the processed file to be created and its name and make sure "Process" is ticked

Cumulus will then create a file with the webatgs converted to php variables I have attached a "processed" file

Andy
You do not have the required permissions to view the files attached to this post.
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Webtags in PHP

Post by mcrossley »

CumulusBat wrote: Fri 26 Aug 2022 1:34 am I use the CumulusMx templates by Neil Thomas.

I can run a php script in my page. Example, the sun meridian time.

I live in Canada and I don't want to display the heat index in winter and the wind chill in summer.

So by having the temperature in a php variable I could write a script as needed.

I tried this script:
<?php
$p = "<#temp>";
echo $p;
?>
and I get this:
<#temp>
Ok, so you need to understand how the new web site works. The old page site processed and uploaded every page for every update, so you could do what you have coded now.

The new web site does not upload the pages at all. Only a JSON data file containing all the data values gets uploaded. So you will have to change your PHP to parse that JSON file, then use those parsed values in your page code.
CumulusBat
Posts: 7
Joined: Thu 25 Aug 2022 7:24 pm
Weather Station: Davis Vantage Pro
Operating System: Windows 10

Re: Webtags in PHP

Post by CumulusBat »

Big Daddy wrote: Fri 26 Aug 2022 7:38 am The file can go anywhere. I put mine in the CumulusMX root folder.

In Extra Web Files, fill in where the above file is and where you want the processed file to be created and its name and make sure "Process" is ticked

Cumulus will then create a file with the webatgs converted to php variables I have attached a "processed" file

Andy
Thanks you! I managed to read the JSON and it works.
Post Reply