Php webtags: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
130 bytes added ,  17:35, 26 June 2020
m
Line 140: Line 140:


**Also when returning string information Cumulus can include embedded quotes: e.g. <code>$LatestError = "Latest Error: 'Some filename was locked" recorded';</code> as the embedded ones are double quotes, single quotes are used in <code>$LatestError='<#LatestError>';</code> in the template file as delimiters for the whole string. Equally Longitude and Latitude web tags by default label the minutes and seconds part with the same symbols as used by quotes, so we have to choose the alternative decimal notation <code>$longitude=<#longitude dp=5>;</code>
**Also when returning string information Cumulus can include embedded quotes: e.g. <code>$LatestError = "Latest Error: 'Some filename was locked" recorded';</code> as the embedded ones are double quotes, single quotes are used in <code>$LatestError='<#LatestError>';</code> in the template file as delimiters for the whole string. Equally Longitude and Latitude web tags by default label the minutes and seconds part with the same symbols as used by quotes, so we have to choose the alternative decimal notation <code>$longitude=<#longitude dp=5>;</code>
*Yet another complication (for Cumulus 1 users) is that the values for  [[Webtags#Time.2FDate_.27format.27_Parameter|formatting parameters]] can include double and single quotes, but any assignment to a PHP variable requires the value to be quoted so it is treated as a string.  There are two ways round this, one is to concatenate several uses of the same Cumulus web tag to build up the required layout without using both versions of quotation marks within any single formatting value e.g. <code>$LastDataReadTDM='<#LastDataReadT format=h:nn'.' on '.'<#LastDataReadT format="d mmm">';</code>, and the other is to use the PHP 'heredoc' approach - see PHP manual.
*Yet another complication (for Cumulus 1 users) is that the values for  [[Webtags#Time.2FDate_.27format.27_Parameter|time and date formatting parameters]] can include double and single quotes, but any assignment to a PHP variable of text like that requires the value to be quoted so it is treated as a string.  There are some ways round this, one is to concatenate several uses of the same Cumulus web tag to build up the required layout without using both versions of quotation marks within any single formatting value e.g. <code>$LastDataReadTDM='<#LastDataReadT format=h:nn'.' on '.'<#LastDataReadT format="d mmm">';</code>, and another is to use the PHP 'heredoc' approach - see PHP manual. For MX then it may be possible to avoid single quotes by using the backslash to escape characters.
*Cumulus MX web tags do allow embedding of HTML, see the [[Webtags|Web tags article]] for details.
*Cumulus MX web tags do allow embedding of HTML, see the [[Webtags|Web tags article]] for details.


5,838

edits

Navigation menu