Php webtags: Difference between revisions

84 bytes added ,  19:28, 20 April 2020
m
Line 77: Line 77:
Otherwise, apart from a few web tags that report dates where alternative formats are added (as shown below) using output parameters and new variable names, most php variable names match the corresponding web tags name, there are no alternatives for the time-stamps and date-stamps in any weather derivatives. You will notice the USA style month first bias of the original authors in some of the date formats below.
Otherwise, apart from a few web tags that report dates where alternative formats are added (as shown below) using output parameters and new variable names, most php variable names match the corresponding web tags name, there are no alternatives for the time-stamps and date-stamps in any weather derivatives. You will notice the USA style month first bias of the original authors in some of the date formats below.


'''Note there is an error in these files''' - they contain a "?>" at the end, that should not be used in pure PHP files - see PHP manual instruction.  Should white-space or new lines being added after the PHP closing tag, even accidentally,  there may be unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script. That applies even if the extra is after the include/require in the script using this file.
'''Note there is an error in every single one of these files''' - they contain a "?>" at the end, that should not be used in pure PHP files - see PHP manual instruction.  Should white-space or new lines being added after the PHP closing tag, even accidentally,  there may be unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script. That applies even if the extra is after the include/require in the script using this file.
<pre>$date2          = strtotime(str_replace('/','-',"<#date>"));  //  current date (example format: 1346569200)
<pre>$date2          = strtotime(str_replace('/','-',"<#date>"));  //  current date (example format: 1346569200)
$dateU              = strtotime(str_replace('/','-',"<#date>"));  //  current date (Unix datestamp format)
$dateU              = strtotime(str_replace('/','-',"<#date>"));  //  current date (Unix datestamp format)
Line 102: Line 102:
*For version 3.5.3 (build 3074), a single template file can be downloaded from [https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=17991 CumulusMX PHPwebtags] topic in the support forum, posted by the administrator (water01) as an update to the one below.
*For version 3.5.3 (build 3074), a single template file can be downloaded from [https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=17991 CumulusMX PHPwebtags] topic in the support forum, posted by the administrator (water01) as an update to the one below.
*An equivalent for version 3.0.x is at [https://cumulus.hosiene.co.uk/viewtopic.php?f=39&t=13252&p=103860&hilit=cumuluswebtags.txt#p103830 this page on  support forum] also posted by the administrator (water01), and developed from the . This one does not contain any web tags added since 2015, but use this one also for versions before 3.5.3 to avoid any errors being reported and accept it may not include some of the web tags available in in-between versions.
*An equivalent for version 3.0.x is at [https://cumulus.hosiene.co.uk/viewtopic.php?f=39&t=13252&p=103860&hilit=cumuluswebtags.txt#p103830 this page on  support forum] also posted by the administrator (water01), and developed from the . This one does not contain any web tags added since 2015, but use this one also for versions before 3.5.3 to avoid any errors being reported and accept it may not include some of the web tags available in in-between versions.
* An alternative approach in the early days of MX was taken by Duke. You can download his version from [https://cumulus.hosiene.co.uk/viewtopic.php?f=6&t=10424#p99536 this storm rain topic]. His zip contains two files '''cumulustags_no_description.tpl''' and '''cumulustags_with_description.tpl''', each uses the approach of defining an array $WX in which the index to the array elements is the web tag name for example <tty>$WX['rfall'] = '<#rfall>';  //  total rainfall so far today</tty>. It contains all tags used by either Cumulus 1 or MX  in September 2014. If you use this script you need to call it by '''require_once 'cumulustags_with_description.'''' because it contains functions that can only be declared once to convert between decimal degrees and degrees, minutes, seconds formats in either direction, basically because it it stripping out the HTML space characters used by Steve Loft for latitude and longitude. For Recent History web tags there are up to 27 different input parameters in some cases. The extra time and date parameters shown above appear, but as array elements e.g. <tty>$WX['timeshort']  = '<#time format="hh:nn">';  //  current time (example format: 12:34)</tty>.
*For the final version 1.9.4 of Cumulus 1 use the download file available on [[File:Cumuluswebtags.txt this wiki page]]). Note that in this download the recent history tags only occur with a single 3 hours ago parameter but if you use these tags it is likely you will want to include them for several other periods too.  Edit this template file to put in the necessary time selectors yourself.
*For the final version 1.9.4 of Cumulus 1 use the download file available on [[File:Cumuluswebtags.txt this wiki page]]). Note that in this download the recent history tags only occur with a single 3 hours ago parameter but if you use these tags it is likely you will want to include them for several other periods too.  Edit this template file to put in the necessary time selectors yourself.
** The advantage of only choosing one possible input parameter is that this template can use PHP variable names that match the web tag name, and only use PHP arrays when the web tag returns an array.
** The advantage of only choosing one possible input parameter is that this template can use PHP variable names that match the web tag name, and only use PHP arrays when the web tag returns an array.
* An earlier alternative in [https://cumulus.hosiene.co.uk/viewtopic.php?f=6&t=10424#p99536 this storm rain topic] is by Duke. His zip contains two files '''cumulustags_no_description.tpl''' and '''cumulustags_with_description.tpl''', each uses the approach of defining an array $WX in which the index to the array elements is the web tag name for example <tty>$WX['rfall'] = '<#rfall>';  //  total rainfall so far today</tty>. It contains all tags used by either Cumulus 1 or MX  in September 2014. If you use this script you need to call it by '''require_once 'cumulustags_with_description.'''' because it contains functions that can only be declared once to convert between decimal degrees and degrees, minutes, seconds formats in either direction, basically because it it stripping out the HTML space characters used by Steve Loft for latitude and longitude. For Recent History web tags there are up to 27 different input parameters in some cases. The extra time and date parameters shown above appear, but as array elements e.g. <tty>$WX['timeshort']  = '<#time format="hh:nn">';  //  current time (example format: 12:34)</tty>.


=== Alternatives ===
=== Alternatives ===
5,838

edits