Webtags (preserving history): Difference between revisions

m
m (→‎Day/Night/Sun/Moon: Response to https://cumulus.hosiene.co.uk/viewtopic.php?p=154115#p154115)
Line 2,244: Line 2,244:


==Day/Night/Sun/Moon==
==Day/Night/Sun/Moon==
These are updated each hour to refer to current time-zone
In Cumulus 1 most of these are only calculated at UTC zero hours, but are updated each hour to refer to current time-zone.
 
MX is more complicated, but most of these are calculated hourly.
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Line 2,271: Line 2,273:
|-
|-
|<#daylightlength>
|<#daylightlength>
|Length of daylight in hours and minutes (dawn to dusk)
| Approximate length of daylight in hours and minutes (dawn to dusk) - if your timezone is UTC or a few hours off that,  the dusk may well be that just passed, and the dawn that to come as at the zero hours UTC when Cumulus 1 does this calculation
|-
|-
|<#isdaylight>
|<#isdaylight>
Line 2,282: Line 2,284:
|A string giving an approximate predicted difference between the length of daylight (dawn to dusk) yesterday and length of daylight tomorrow.
|A string giving an approximate predicted difference between the length of daylight (dawn to dusk) yesterday and length of daylight tomorrow.


This web tag is unreliable, and its use is not recommended. Its use is therefore not supported (i.e. you use it at your own risk).
This web tag is unreliable, basically because of the note for <#daylightlength>, and its use was not recommended. Its use is therefore not supported by Steve Loft (i.e. you use it at your own risk) in the legacy Cumulus.
|-
|-
|<#moonphase>
|<#moonphase>
Line 2,291: Line 2,293:


MX b3047 adds the 'dp' and 'rc' parameters Supports an optional 'dp' parameter, if supplied the result is returned to the specified number of decimal places. E.g <#MoonAge> gives "11" <#MoonAge dp=3> gives "11.234"
MX b3047 adds the 'dp' and 'rc' parameters Supports an optional 'dp' parameter, if supplied the result is returned to the specified number of decimal places. E.g <#MoonAge> gives "11" <#MoonAge dp=3> gives "11.234"
If the "dp" parameter is supplied, then also supplying "rc=y" in addition will cause any decimal comma to be converted to a decimal point.
 
There is some PHP script code below this table showing how this can be converted to days, hours, minutes, seconds*
 
If the "dp" parameter is supplied, then supplying "rc=y" in addition will cause any decimal comma to be converted to a decimal point.
|-
|-
|<#moonrise>
|<#moonrise>
Line 2,321: Line 2,326:
|Returns 1 if the sun is shining, otherwise 0 (Solar sensor needed)
|Returns 1 if the sun is shining, otherwise 0 (Solar sensor needed)
|}
|}
*<code>
$MoonAgeDays = <#MoonAge dp=0> +0;
$moonDecimalPart = <#MoonAge dp=4> - $MoonAgeDays;
$MoonAgeHours = round($moonDecimalPart * 24, 0);
$MoonAgeMinutes  = round(($moonDecimalPart * 24 * 60) - ($MoonAgeHours * 60), 0);
$MoonAgeSeconds = round(($moonDecimalPart * 24 * 60 * 60) - ($MoonAgeHours * 60 * 60) - ($MoonAgeMinutes * 60), 3);
$MoonAge      =    $MoonAgeDays . '&nbsp;days, ' .  $MoonAgeHours . '&nbsp;hours, '
. $MoonAgeMinutes . '&nbsp;minutes, ' . $MoonAgeSeconds . '&nbsp;seconds';
// Change the English words 'days, ', ' hours, ', and 'minutes' to the equivalents in your language</code>


==Alarms==
==Alarms==
5,838

edits