Page 1 of 1
Webtags in PHP
Posted: Thu 25 Aug 2022 7:35 pm
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?
Re: Webtags in PHP
Posted: Thu 25 Aug 2022 7:49 pm
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.
Re: Webtags in PHP
Posted: Thu 25 Aug 2022 8:01 pm
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
Re: Webtags in PHP
Posted: Fri 26 Aug 2022 1:34 am
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>
Re: Webtags in PHP
Posted: Fri 26 Aug 2022 1:39 am
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) ?
Re: Webtags in PHP
Posted: Fri 26 Aug 2022 7:38 am
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
Re: Webtags in PHP
Posted: Fri 26 Aug 2022 9:55 am
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.
Re: Webtags in PHP
Posted: Sun 28 Aug 2022 12:23 pm
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.