Cumulus template file: Difference between revisions

3,661 bytes added ,  22:52, 7 April 2021
m
Line 52: Line 52:
#Next you ask Cumulus [[Customised_templates#What_to_select_on_the_.27Files.27_tab_of_the_Internet_Settings_screen_within_the_.27Configuration.27_menu|to process]] that template file, it will create a HTML page from the template, and during that file creation replace the tag with the current value of the item the tag represents.
#Next you ask Cumulus [[Customised_templates#What_to_select_on_the_.27Files.27_tab_of_the_Internet_Settings_screen_within_the_.27Configuration.27_menu|to process]] that template file, it will create a HTML page from the template, and during that file creation replace the tag with the current value of the item the tag represents.
#You also need to tell Cumulus that the resulting HTML file is to be uploaded to the internet (or copied to a local web server).
#You also need to tell Cumulus that the resulting HTML file is to be uploaded to the internet (or copied to a local web server).
==== Case sensitivity ====
The tag_name in the general format above is case sensitive, so please type the tag name exactly as shown in the web tag columns in the tables on the [Webtags|web tags page]].
The optional input parameters always use lower case, so please type them exactly as shown in the sections dealing with input parameters on that page.
The optional output parameters are case insensitive when used in Cumulus 1. But for Cumulus 2 and later, so this includes MX, the output parameters are case sensitive and also dependent on what other output formatters are being used if any, so please read the sections on output parameters and study the examples in the tables carefully.


=== Using web tags in scripts ===
=== Using web tags in scripts ===
Line 65: Line 74:
*Alternatively, in most script languages, apply ' * 1', i.e. multiply by one, to implicitly convert the tag from string to base 10 number.
*Alternatively, in most script languages, apply ' * 1', i.e. multiply by one, to implicitly convert the tag from string to base 10 number.
*Another alternative is to add zero when a web tag is being assigned to a script variable, this is frequently used in scripts where the web tag being used is not available in all versions of Cumulus, because Cumulus does not implement the concept of null values and often zero is used when a true value is not available because that sensor is not installed for example. Adding 0 means that if the web tag is not recognised, the script is still able to give a variable in its language some value and won't fail because that variable is undefined. If the web tag is available, adding zero does not prevent the true value of that web tag being assigned to the variable.
*Another alternative is to add zero when a web tag is being assigned to a script variable, this is frequently used in scripts where the web tag being used is not available in all versions of Cumulus, because Cumulus does not implement the concept of null values and often zero is used when a true value is not available because that sensor is not installed for example. Adding 0 means that if the web tag is not recognised, the script is still able to give a variable in its language some value and won't fail because that variable is undefined. If the web tag is available, adding zero does not prevent the true value of that web tag being assigned to the variable.
==Inconsistency of web tag names==
Some tags are all lower-case, some are camel-case, and some start with a capital letter. Have a look yourself at just how much inconsistency is present in the names in the tables below. The great inconsistency in the naming, gives rise to a problem as it very easy to spell a tag_name incorrectly as you naturally expect there to be a standard pattern.
You will find yourself frequently having to refer to this article, if you decide to make your own Cumulus templates (see section below for more information). This applies whether those templates are for [[Customised templates|web pages]],  to implement [[Xml webtags|Extensible Mark-up Language files]],  or [[Php webtags|PHP Hypertext Pre-processor scripts]].
When Steve Loft introduced the first web tags as part of developing software for his own use, he did not create a naming standard to ensure consistency in the future. As he introduced further web tags at different times, the names used might be consistent amongst the ones introduced that day, but there was still no naming convention to ensure consistency with tags introduced previously or to help name future tags.
===Inconsistency for today, yesterday, this month, this year groups===
It would be easier if all tags reporting parameters for today were consistent, let alone consistency in naming between tags for today and yesterday.  The tags for this year and this month were introduced in same release, so there is some consistency in how they were named then, but no standard to ensure future tags for this month and this year would be named the same way.
===Inconsistency in use of "Y"===
*The character "Y" might be included in a web tag to denote '''yesterday''', or it might denote ''this year''
*Where the Y is indicating '''yesterday''', it is sometimes a ''prefix'', sometimes a ''suffix''!
===Inconsistency in use of "T"===
*The newer web tags for '''today''' include a "T" as a suffix, the older ones do not. 
**The lack of a "T" in some today tags causes some confusion with all-time record tags as they have a similar naming structure to these older today web tags.
**This is particularly confusing and is why you must look up today, and all-time, tags in the tables in this article.
*The time-stamp tags add a "T" to the corresponding web tag for the value, but in an inconsistent way:
**the T is a prefix sometimes and
**the T is a suffix sometimes
**This is particularly confusing and is why you must look up time-stamp tags in the tables in this article.
===Choosing script variable names derived from tag names===
In the web tag to PHP variable scripts, I have posted, see [[Php_webtags#Minimised_Upload_size]], I have tried to introduce better consistency in the PHP variable names, so "T" is added as a suffix to all "today" variables for example. Some other script authors try to match the inconsistent web tag names, so their script variable names are also inconsistent.


=Cumulus MX=
=Cumulus MX=
5,838

edits