5,838
edits
2. One convention is to make the php_variable_name match the cumulus_tag_name. This breaks down if you use names like $version for other purposes, or if you get confused by the random naming standard adopted by Steve Loft (some yesterday tags have Y at end, some don't, sometimes Y means yesterday, other times Y means yearly), so feel feel free to invent you own consistent naming standard.
3. If the cumulus web tag always returns a numeric value, it is better to leave off the quotes, because then it can be used in PHP arithmetic more easily. To discover all available web tags for the Cumulus version you are using see [[Webtags|top of Web tags page]]. See the examples at the start of this article for some monthly tags that don't return numerical values on the first day of a month.
4. I have shown single quotes
5. In the format example, I mention input parameters, see the [[Webtags|Web tags article]] page for full details of where you can use them, but they might indicate what information you are seeking if like '''Recent History''' you can get values for a range of different times. I also mention output formats, these are also explained on the web tags page, but they might select whether a time is shown in am/pm format or 24-hour format, whether a date uses the full month name or a number and so on. You might want to quote the same web tag with different selections and either assign each to a different variable name or to a different element of an array variable.
6. You can include PHP comments any where you like, if on a separate line delimit by "/*" to "*/", if at end of line prefix by "#" or "//". '''Don't put any special characters''' at the end of this file, it will become '''pure PHP''', and that '''never uses a terminator''' "?>".
7. I say above "1 or more template files". Since you can tell Cumulus to process/upload files at different intervals, you might want to include those web tags that change frequently (now and today for example) in a template file that you will action at the real time interval, and include those web tags that rarely change (e.g. yesterday, station-related, units) in a template file that is only uploaded at end of day. Yet another template file can be uploaded at normal updating interval, that might include the monthly and yearly tags for example. You decide what suits your own restrictions on total size of files to upload at different frequencies.
'''For more information''' on how to write a template file or how to ask Cumulus to process files see [[Customised_templates#What_is_meant_by_.27Cumulus_processes_templates.27|processed by Cumulus]] topic.
==== Ready made PHP Web Tag templates ====
'''Instead of producing your own template''', there are a number already produced (if they contain output parameters they are specific to a particular flavour of Cumulus), of course ''none of them cover all web
*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).
*The download file on '''this page''' (download [[File:Cumuluswebtags.txt]]) contains all current [[webtags]] produced by Cumulus v 1.9.4. '''IMPORTANT''' This file is only for use with Cumulus v1.9.4, it will not work with [[Cumulus MX|Cumulus 3 (MX)]]. 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 so if you want to use them you need to put in the necessary time selectors yourself.▼
*
▲*
*An
* Another simple template produced by BCJKiwi that works with both Cumulus 1 and MX is at [https://cumulus.hosiene.co.uk/viewtopic.php?f=40&t=17985&p=140688#p140688 this post of mine in a zip], this one does not contain any web tags that are only available in MX, nor does it contain any that require output parameters.
=== Option 3: EXtensible Markup Language alternative ===
|
edits