Php webtags: Difference between revisions

1,233 bytes added ,  20 April 2020
m
=Option 2 - implementation details=
 
The installation, usage, and example sections below apply to optiona 2template file called "cumuluswebtags.phptxt", butso if you are similarusing fora file with another name or multiple template files, adapt the otherinstructions as optionsrelevant.
 
==Installation (withChoose Cumulusyour 1template(s) ==
 
First either download a read made template, choosing from those available as listed above; or write your own template(s) following the guidance above.
##For the file you have downloaded at option 2 above, open it in any text editor (preferably one that works in "UTF-8 without BOM").
 
##If the first line contains the following sequence of 4 characters "'''&''' '''l''' '''t''' ''';'''" then replace all of those with just one "''<''" (so the first line becomes "''<php''") NOTE - the Wiki cannot have a PHP script uploaded to it, so changing the first line stops the Wiki from treating it as PHP script, but after Cumulus has processed it (Cumulus does not care what it processes, but will copy anything it does not recognise across unchanged) we do want the generated file to be treated as a PHP script.
== Edit your template(s) ==
#Next add any parameter combinations that you need for your own implementation. For example, for my implementation, I found that my customisation of the template version had used many more Cumulus web tags with parameters than I expected, consequently my cumuluswebtag.cum template file has (amongst others) the following extras
 
#*$LastDataReadTDM='<#LastDataReadT format=h:nn'.' on '.'<#LastDataReadT format="d mmm">';
If you have chosen a ready made template, or have realised you need a PHP variable for a different set of parameters to those coded already, you will need to edit your template.
#*$LastDataReadTDMY='<#LastDataReadT format="h:nn am/pm"> on calendar day <#LastDataReadT format="dddd d mmmm yyyy">';
 
#*$LastTimeStamp='<#LastDataReadT format="h:nn 'on' d mmm">';
# It is best to use an editor that allows you to choose the encoding for the file it saves. Any editor designed for editing code should do this (e.g. Notepad++), but word processors and the popular online editors will add unwanted extra characters. The best encoding for files to work with Cumulus is "UTF-8 without BOM".
#*$metdateM='<#metdate format="mmm">';
# Open your file in your chosen editor.
#*$metdateMM='<#metdate format="mmmm">';
##*If the first line contains the following sequence of 4 characters "'''&''' '''l''' '''t''' '''lt;'''" then replace allthose of4 thosecharacters with justa onesingle "''<''" (so the first line becomes "''<php''") NOTE - the Wiki cannot have a PHP script uploaded to it, so changing the first line stops the Wiki from treating it as PHP script, but after Cumulus has processed it (Cumulus does not care what it processes, but will copy anything it does not recognise across unchanged) we do want the generated file to be treated as a PHP script.
#*$monthYear='<#metdate format="mmmm yyyy">';
#Add any new web tags that have been added for the Cumulus version you are using, that were not available when the template was created.
#*$monthStart='<#metdate format="yyyy-mm-01">';
#Next look at any web tags that can take input and/or output parameters; add any parameter combinations that you need for your own implementation.
#you can also delete any rows with web tags that are not relevant to your weather station model for greater efficiency;
#Next add any parameter combinations that you need for your own implementation. *For example, for my implementation, I found that my customisation of the template version had used many more Cumulus web tags with parameters than I expected, consequently my cumuluswebtag.cum template file has (amongst others) the following extras
#then save the resulting file in the local directory (that Cumulus can read) where you store your customised templates (you could use the "cumuluswebtagsT.cum" type convention as I do because of all my customisations, but to keep it simple the suggestion here is to retain the name as "cumuluswebtags.txt" if you are basically using the provided code).[[File:ScreenShot-PHPWebtags-ConfigSetup.png|right|'Screenshot top and bottom extracts Cumulus v1.9.4']]
#**$LastDataReadTDM='<#LastDataReadT format=h:nn'.' on '.'<#LastDataReadT format="d mmm">';
#**$LastDataReadTDMY='<#LastDataReadT format="h:nn am/pm"> on calendar day <#LastDataReadT format="dddd d mmmm yyyy">';
#**$LastTimeStamp='<#LastDataReadT format="h:nn 'on' d mmm">';
#**$metdateM='<#metdate format="mmm">';
#**$metdateMM='<#metdate format="mmmm">';
#**$monthYear='<#metdate format="mmmm yyyy">';
#**$monthStart='<#metdate format="yyyy-mm-01">';
#you can alsoNext delete any rows with web tags that are not relevant to your weather station model for greater efficiency;
# Finally save your edited template file or files in either the "web" directory where Cumulus has the files it will process or where you store your customised templates.
#* The choice of filename and extension is up to you, it might make sense to use a different name or extension (e,g. "cumuluswebtagsT.cumMX"), if you have edited the file to be sure you don't confuse it and the original and you know which version of Cumulus it is for.
#* If you have several templates being uploaded at different intervals you might choose names like "webtagsRealtimeT.txt", "webtagsNormalT.txt" and "webtagsEoDT.txt".
 
#thenHere saveis thea resultingscreenshot file in the local directory (thatfor Cumulus can read) where you store your customised templates (you could use the "cumuluswebtagsT.cum" type convention as I do because of all my customisations, but to keep it simple the suggestion here is to1 retainusing the name as "cumuluswebtags.txt" if you are basically using the provided code).[[File:ScreenShot-PHPWebtags-ConfigSetup.png|right|'Screenshot top and bottom extracts Cumulus v1.9.4']]
#On the 'Cumulus main screen', in the '''Configuration''' menu, select the ''Internet'' option;
#On the 'Internet Settings' screen, select the ''Files'' tab;<br><br>
5,838

edits